-
Notifications
You must be signed in to change notification settings - Fork 0
/
q.html
172 lines (172 loc) · 7.14 KB
/
q.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
<!DOCTYPE html>
<html>
<head>
<title>Interview Questions</title>
<link rel="stylesheet" href="lib/themes/default/style.min.css" />
<script type="text/javascript" src="lib/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="lib/jstree.min.js"></script>
<script type="text/javascript" src="scripts/input.js"></script>
<script type="text/javascript" src="scripts/core.js"></script>
<script type="text/javascript" src="scripts/1.js"></script>
<script type="text/javascript" src="scripts/2.js"></script>
<script type="text/javascript" src="scripts/3.js"></script>
<script type="text/javascript" src="scripts/4.js"></script>
<script type="text/javascript" src="scripts/5.js"></script>
<script type="text/javascript" src="scripts/6.js"></script>
<script type="text/javascript" src="scripts/7.js"></script>
<script type="text/javascript" src="scripts/8.js"></script>
<script type="text/javascript" src="scripts/9.js"></script>
<script type="text/javascript" src="scripts/10.js"></script>
<script type="text/javascript" src="scripts/11.js"></script>
<script type="text/javascript" src="scripts/12.js"></script>
<script type="text/javascript" src="scripts/13.js"></script>
<script type="text/javascript" src="scripts/14.js"></script>
<script type="text/javascript" src="scripts/15.js"></script>
<style type="text/css">
.hidden {
display: none;
}
</style>
</head>
<body>
<div>
<div id="next-right">
<button id="button-next-right">binary tree next right</button>
<pre id="result-next-right" class="hidden"></pre>
</div>
<div id="max-height">
<button id="button-max-height">binary tree maximum height</button>
<pre id="result-max-height" class="hidden"></pre>
</div>
<div id="best-time-tobuy-and-sell-stock">
<button id="button-best-time-tobuy-and-sell-stock">best time to buy and sell stock</button>
<pre id="result-best-time-tobuy-and-sell-stock" class="hidden"></pre>
</div>
<div id="largest-number">
<button id="button-largest-number">largest number</button>
<pre id="result-largest-number" class="hidden"></pre>
</div>
<div id="find-digits">
<button id="button-find-digits">digits</button>
<pre id="result-find-digits" class="hidden"></pre>
</div>
<div id="flipping-bits">
<button id="button-flipping-bits">flipping bits</button>
<pre id="result-flipping-bits" class="hidden"></pre>
</div>
<div id="utopian-tree">
<button id="button-utopian-tree">utopian tree</button>
<pre id="result-utopian-tree" class="hidden"></pre>
</div>
<div id="is-fibonacci">
<button id="button-is-fibonacci">is fibonacci</button>
<pre id="result-is-fibonacci" class="hidden"></pre>
</div>
<div id="angry-children">
<button id="button-angry-children">angry children</button>
<pre id="result-angry-children" class="hidden"></pre>
</div>
<div id="word-permutation">
<button id="button-word-permutation">word permutation</button>
<pre id="result-word-permutation" class="hidden"></pre>
</div>
<div id="word-combination">
<button id="button-word-combination">word combination</button>
<pre id="result-word-combination" class="hidden"></pre>
</div>
<div id="speak-number">
<button id="button-speak-number">speak number</button>
<pre id="result-speak-number" class="hidden"></pre>
</div>
<div id="wordament">
<button id="button-wordament">wordament</button>
<pre id="result-wordament" class="hidden"></pre>
</div>
<div id="longest-compound-word">
<button id="button-longest-compound-word">longest compound word</button>
<pre id="result-longest-compound-word" class="hidden"></pre>
</div>
<div id="balanced-bst">
<button id="button-balanced-bst">balanced BST</button>
<pre id="result-balanced-bst" class="hidden"></pre>
</div>
</div>
<script type="text/javascript">
$('#button-next-right').on('click', function() {
var result = JSON.stringify(q1.exec(), null, 2);
$('#result-next-right').html(result);
$('#result-next-right').toggleClass('hidden');
});
$('#button-max-height').on('click', function() {
var result = q2.exec();
$('#result-max-height').html(result);
$('#result-max-height').toggleClass('hidden');
});
$('#button-best-time-tobuy-and-sell-stock').on('click', function() {
var result = q3.exec();
$('#result-best-time-tobuy-and-sell-stock').html(result);
$('#result-best-time-tobuy-and-sell-stock').toggleClass('hidden');
});
$('#button-largest-number').on('click', function() {
var result = q4.exec();
$('#result-largest-number').html(result);
$('#result-largest-number').toggleClass('hidden');
});
$('#button-find-digits').on('click', function() {
var result = q5.exec();
$('#result-find-digits').html(result);
$('#result-find-digits').toggleClass('hidden');
});
$('#button-flipping-bits').on('click', function() {
var result = q6.exec();
$('#result-flipping-bits').html(result);
$('#result-flipping-bits').toggleClass('hidden');
});
$('#button-utopian-tree').on('click', function() {
var result = q7.exec();
$('#result-utopian-tree').html(result);
$('#result-utopian-tree').toggleClass('hidden');
});
$('#button-is-fibonacci').on('click', function() {
var result = q8.exec();
$('#result-is-fibonacci').html(result);
$('#result-is-fibonacci').toggleClass('hidden');
});
$('#button-angry-children').on('click', function() {
var result = q9.exec();
$('#result-angry-children').html(result);
$('#result-angry-children').toggleClass('hidden');
});
$('#button-word-permutation').on('click', function() {
var result = q10.exec();
$('#result-word-permutation').html(result);
$('#result-word-permutation').toggleClass('hidden');
});
$('#button-word-combination').on('click', function() {
var result = q11.exec();
$('#result-word-combination').html(result);
$('#result-word-combination').toggleClass('hidden');
});
$('#button-speak-number').on('click', function() {
var result = q12.exec();
$('#result-speak-number').html(result);
$('#result-speak-number').toggleClass('hidden');
});
$('#button-wordament').on('click', function() {
var result = q13.exec();
$('#result-wordament').html(result.length + '\n' + result.join(', '));
$('#result-wordament').toggleClass('hidden');
});
$('#button-longest-compound-word').on('click', function() {
var result = q14.exec();
$('#result-longest-compound-word').html(result);
$('#result-longest-compound-word').toggleClass('hidden');
});
$('#button-balanced-bst').on('click', function() {
var result = q15.exec();
$('#result-balanced-bst').html(result);
$('#result-balanced-bst').toggleClass('hidden');
});
</script>
</body>
</html>