Home

Awesome

:pencil2: Leetcode Solutions with javascript

Update time: 2016-11-24 21:14:45

Auto created by leetcode_generate Usage

I have solved 141 / 429 problems while there are 78 problems still locked.

If you have any question, please give me an issue.

If you are loving solving problems in leetcode, please contact me to enjoy it together!

(Notes: :lock: means you need to buy a book from Leetcode to unlock the problem)

#TitleSource CodeArticleDifficulty
1two-sumjavascript:memo:Easy
2add-two-numbersjavascript:memo:Medium
3longest-substring-without-repeating-charactersjavascript:memo:Medium
4median-of-two-sorted-arraysjavascriptHard
5longest-palindromic-substringjavascript:memo:Medium
6zigzag-conversionjavascriptEasy
7reverse-integerjavascriptEasy
8string-to-integer-atoiEasy
9palindrome-numberjavascriptEasy
10regular-expression-matchingHard
11container-with-most-water:memo:Medium
12integer-to-romanjavascriptMedium
13roman-to-integerjavascriptEasy
14longest-common-prefixjavascript:memo:Easy
153sumjavascriptMedium
163sum-closestMedium
17letter-combinations-of-a-phone-numberMedium
184sumMedium
19remove-nth-node-from-end-of-listjavascript:memo:Easy
20valid-parenthesesjavascriptEasy
21merge-two-sorted-listsjavascriptEasy
22generate-parenthesesMedium
23merge-k-sorted-listsjavascriptHard
24swap-nodes-in-pairsjavascriptEasy
25reverse-nodes-in-k-groupjavascriptHard
26remove-duplicates-from-sorted-arrayjavascript:memo:Easy
27remove-elementjavascript:memo:Easy
28implement-strstrjavascriptEasy
29divide-two-integersMedium
30substring-with-concatenation-of-all-wordsHard
31next-permutation:memo:Medium
32longest-valid-parenthesesHard
33search-in-rotated-sorted-arrayjavascriptHard
34search-for-a-rangejavascriptMedium
35search-insert-positionjavascriptMedium
36valid-sudokujavascriptEasy
37sudoku-solverHard
38count-and-sayEasy
39combination-sumMedium
40combination-sum-iiMedium
41first-missing-positivejavascriptHard
42trapping-rain-waterHard
43multiply-stringsMedium
44wildcard-matchingHard
45jump-game-iiHard
46permutationsMedium
47permutations-iiMedium
48rotate-imageMedium
49anagramsjavascriptMedium
50powx-njavascriptMedium
51n-queensHard
52n-queens-iiHard
53maximum-subarrayMedium
54spiral-matrixMedium
55jump-gamejavascript:memo:Medium
56merge-intervalsHard
57insert-intervalHard
58length-of-last-wordjavascriptEasy
59spiral-matrix-iiMedium
60permutation-sequenceMedium
61rotate-listjavascriptMedium
62unique-pathsMedium
63unique-paths-iiMedium
64minimum-path-sumMedium
65valid-numberHard
66plus-onejavascriptEasy
67add-binaryjavascriptEasy
68text-justificationHard
69sqrtxjavascriptMedium
70climbing-stairsjavascriptEasy
71simplify-pathMedium
72edit-distanceHard
73set-matrix-zeroesjavascriptMedium
74search-a-2d-matrixMedium
75sort-colorsjavascriptMedium
76minimum-window-substringHard
77combinationsMedium
78subsetsjavascriptMedium
79word-searchMedium
80remove-duplicates-from-sorted-array-iijavascriptMedium
81search-in-rotated-sorted-array-iijavascriptMedium
82remove-duplicates-from-sorted-list-iijavascriptMedium
83remove-duplicates-from-sorted-listjavascript:memo:Easy
84largest-rectangle-in-histogramHard
85maximal-rectangleHard
86partition-listjavascriptMedium
87scramble-stringHard
88merge-sorted-arrayjavascriptEasy
89gray-codeMedium
90subsets-iijavascriptMedium
91decode-waysMedium
92reverse-linked-list-iijavascriptMedium
93restore-ip-addressesMedium
94binary-tree-inorder-traversaljavascriptMedium
95unique-binary-search-trees-iiMedium
96unique-binary-search-treesMedium
97interleaving-stringHard
98validate-binary-search-treeMedium
99recover-binary-search-treeHard
100same-treejavascriptEasy
101symmetric-treejavascript:memo:Easy
102binary-tree-level-order-traversalEasy
103binary-tree-zigzag-level-order-traversalMedium
104maximum-depth-of-binary-treejavascriptEasy
105construct-binary-tree-from-preorder-and-inorder-traversalMedium
106construct-binary-tree-from-inorder-and-postorder-traversalMedium
107binary-tree-level-order-traversal-iiEasy
108convert-sorted-array-to-binary-search-treeMedium
109convert-sorted-list-to-binary-search-treeMedium
110balanced-binary-treeEasy
111minimum-depth-of-binary-treejavascriptEasy
112path-sumEasy
113path-sum-iiMedium
114flatten-binary-tree-to-linked-listMedium
115distinct-subsequencesHard
116populating-next-right-pointers-in-each-nodeMedium
117populating-next-right-pointers-in-each-node-iiHard
118pascals-trianglejavascriptEasy
119pascals-triangle-iijavascriptEasy
120trianglejavascriptMedium
121best-time-to-buy-and-sell-stockjavascript:memo:Easy
122best-time-to-buy-and-sell-stock-iijavascript:memo:Medium
123best-time-to-buy-and-sell-stock-iiiHard
124binary-tree-maximum-path-sumHard
125valid-palindromejavascriptEasy
126word-ladder-iiHard
127word-ladderMedium
128longest-consecutive-sequencejavascriptHard
129sum-root-to-leaf-numbersMedium
130surrounded-regionsMedium
131palindrome-partitioningMedium
132palindrome-partitioning-iiHard
133clone-graphMedium
134gas-stationMedium
135candyHard
136single-numberjavascriptEasy
137single-number-iijavascriptMedium
138copy-list-with-random-pointerHard
139word-breakMedium
140word-break-iiHard
141linked-list-cyclejavascript:memo:Easy
142linked-list-cycle-iijavascriptMedium
143reorder-listjavascriptMedium
144binary-tree-preorder-traversaljavascriptMedium
145binary-tree-postorder-traversaljavascriptHard
146lru-cacheHard
147insertion-sort-listjavascriptMedium
148sort-listMedium
149max-points-on-a-lineHard
150evaluate-reverse-polish-notationjavascriptMedium
151reverse-words-in-a-stringjavascriptMedium
152maximum-product-subarrayjavascriptMedium
153find-minimum-in-rotated-sorted-arrayjavascriptMedium
154find-minimum-in-rotated-sorted-array-iijavascriptHard
155min-stackjavascriptEasy
156binary-tree-upside-down:lock:Medium
157read-n-characters-given-read4:lock:Easy
158read-n-characters-given-read4-ii-call-multiple-times:lock:Hard
159longest-substring-with-at-most-two-distinct-characters:lock:Hard
160intersection-of-two-linked-listsjavascript:memo:Easy
161one-edit-distance:lock:Medium
162find-peak-elementjavascriptMedium
163missing-ranges:lock:Medium
164maximum-gapHard
165compare-version-numbersjavascriptEasy
166fraction-to-recurring-decimal:memo:Medium
167two-sum-ii-input-array-is-sortedjavascript:memo:Medium
168excel-sheet-column-titlejavascriptEasy
169majority-elementjavascriptEasy
170two-sum-iii-data-structure-design:lock:Easy
171excel-sheet-column-numberjavascriptEasy
172factorial-trailing-zeroesjavascriptEasy
173binary-search-tree-iteratorMedium
174dungeon-gameHard
179largest-numberMedium
186reverse-words-in-a-string-ii:lock:Medium
187repeated-dna-sequencesMedium
188best-time-to-buy-and-sell-stock-ivHard
189rotate-arrayjavascript:memo:Easy
190reverse-bitsjavascriptEasy
191number-of-1-bitsjavascript:memo:Easy
198house-robberjavascript:memo:Easy
199binary-tree-right-side-viewMedium
200number-of-islandsMedium
201bitwise-and-of-numbers-rangeMedium
202happy-numberjavascriptEasy
203remove-linked-list-elementsjavascriptEasy
204count-primesjavascriptEasy
205isomorphic-stringsjavascriptEasy
206reverse-linked-listjavascript:memo:Easy
207course-scheduleMedium
208implement-trie-prefix-tree:memo:Medium
209minimum-size-subarray-sumMedium
210course-schedule-iiMedium
211add-and-search-word-data-structure-designMedium
212word-search-iiHard
213house-robber-iiMedium
214shortest-palindromeHard
215kth-largest-element-in-an-arrayMedium
216combination-sum-iiiMedium
217contains-duplicatejavascript:memo:Easy
218the-skyline-problemHard
219contains-duplicate-iijavascript:memo:Easy
220contains-duplicate-iii:memo:Medium
221maximal-square:memo:Medium
222count-complete-tree-nodesMedium
223rectangle-areajavascriptEasy
224basic-calculatorHard
225implement-stack-using-queuesjavascript:memo:Easy
226invert-binary-treejavascript:memo:Easy
227basic-calculator-iiMedium
228summary-rangesjavascript:memo:Medium
229majority-element-iijavascriptMedium
230kth-smallest-element-in-a-bstMedium
231power-of-twojavascriptEasy
232implement-queue-using-stacksjavascript:memo:Easy
233number-of-digit-oneHard
234palindrome-linked-listjavascriptEasy
235lowest-common-ancestor-of-a-binary-search-treejavascriptEasy
236lowest-common-ancestor-of-a-binary-treeMedium
237delete-node-in-a-linked-listjavascript:memo:Easy
238product-of-array-except-selfjavascriptMedium
239sliding-window-maximumHard
240search-a-2d-matrix-iijavascriptMedium
241different-ways-to-add-parenthesesMedium
242valid-anagramjavascript:memo:Easy
243shortest-word-distance:lock::memo:Easy
244shortest-word-distance-ii:lock:Medium
245shortest-word-distance-iii:lock:Medium
246strobogrammatic-number:lock:Easy
247strobogrammatic-number-ii:lock:Medium
248strobogrammatic-number-iii:lock:Hard
249group-shifted-strings:lock:Easy
250count-univalue-subtrees:lock:Medium
251flatten-2d-vector:lock:Medium
252meeting-rooms:lock::memo:Easy
253meeting-rooms-ii:lock:Medium
254factor-combinations:lock:Medium
255verify-preorder-sequence-in-binary-search-tree:lock:Medium
256paint-house:lock:Medium
257binary-tree-pathsEasy
258add-digitsjavascriptEasy
2593sum-smaller:lock::memo:Medium
260single-number-iiijavascriptMedium
261graph-valid-tree:lock:Medium
263ugly-numberjavascriptEasy
264ugly-number-iiMedium
265paint-house-ii:lock:Hard
266palindrome-permutation:lock:Easy
267palindrome-permutation-ii:lock:Medium
268missing-numberjavascriptMedium
269alien-dictionary:lock:Hard
270closest-binary-search-tree-value:lock:Easy
271encode-and-decode-strings:lock:Medium
272closest-binary-search-tree-value-ii:lock:Hard
273integer-to-english-wordsHard
274h-index:memo:Medium
275h-index-iiMedium
276paint-fence:lock:Easy
277find-the-celebrity:lock:Medium
278first-bad-versionjavascript:memo:Easy
279perfect-squaresMedium
280wiggle-sort:lock::memo:Medium
281zigzag-iterator:lock:Medium
282expression-add-operatorsHard
283move-zeroesjavascript:memo:Easy
284peeking-iteratorMedium
285inorder-successor-in-bst:lock:Medium
286walls-and-gates:lock::memo:Medium
287find-the-duplicate-numberjavascriptHard
288unique-word-abbreviation:lock::memo:Easy
289game-of-lifeMedium
290word-patternjavascriptEasy
291word-pattern-ii:lock:Hard
292nim-gamejavascript:memo:Easy
293flip-game:lock:Easy
294flip-game-ii:lock:Medium
295find-median-from-data-streamHard
296best-meeting-point:lock::memo:Hard
297serialize-and-deserialize-binary-treeHard
298binary-tree-longest-consecutive-sequence:lock::memo:Medium
299bulls-and-cowsjavascriptEasy
300longest-increasing-subsequenceMedium
301remove-invalid-parenthesesHard
302smallest-rectangle-enclosing-black-pixels:lock:Hard
303range-sum-query-immutablejavascript:memo:Easy
304range-sum-query-2d-immutable:memo:Medium
305number-of-islands-ii:lock:Hard
306additive-numberMedium
307range-sum-query-mutable:memo:Medium
308range-sum-query-2d-mutable:lock:Hard
309best-time-to-buy-and-sell-stock-with-cooldownMedium
310minimum-height-treesMedium
311sparse-matrix-multiplication:lock:Medium
312burst-balloonsHard
313super-ugly-numberMedium
314binary-tree-vertical-order-traversal:lock:Medium
315count-of-smaller-numbers-after-selfHard
316remove-duplicate-lettersHard
317shortest-distance-from-all-buildings:lock:Hard
318maximum-product-of-word-lengthsMedium
319bulb-switcherjavascriptMedium
320generalized-abbreviation:lock:Medium
321create-maximum-numberHard
322coin-change:memo:Medium
323number-of-connected-components-in-an-undirected-graph:lock:Medium
324wiggle-sort-iiMedium
325maximum-size-subarray-sum-equals-k:lock:Medium
326power-of-threejavascript:memo:Easy
327count-of-range-sumHard
328odd-even-linked-listjavascript:memo:Medium
329longest-increasing-path-in-a-matrixHard
330patching-arrayHard
331verify-preorder-serialization-of-a-binary-treeMedium
332reconstruct-itineraryMedium
333largest-bst-subtree:lock:Medium
334increasing-triplet-subsequenceMedium
335self-crossingHard
336palindrome-pairsHard
337house-robber-iiiMedium
338counting-bitsjavascriptMedium
339nested-list-weight-sum:lock::memo:Easy
340longest-substring-with-at-most-k-distinct-characters:lock:Hard
341flatten-nested-list-iteratorMedium
342power-of-fourjavascriptEasy
343integer-breakMedium
344reverse-stringjavascriptEasy
345reverse-vowels-of-a-stringjavascriptEasy
346moving-average-from-data-stream:lock:Easy
347top-k-frequent-elementsjavascriptMedium
348design-tic-tac-toe:lock:Medium
349intersection-of-two-arraysjavascriptEasy
350intersection-of-two-arrays-iijavascriptEasy
351android-unlock-patterns:lock::memo:Medium
352data-stream-as-disjoint-intervalsHard
353design-snake-game:lock:Medium
354russian-doll-envelopesHard
355design-twitterMedium
356line-reflection:lock:Medium
357count-numbers-with-unique-digitsMedium
358rearrange-string-k-distance-apart:lock:Hard
359logger-rate-limiter:lock:Easy
360sort-transformed-array:lock:Medium
361bomb-enemy:lock:Medium
362design-hit-counter:lock:Medium
363max-sum-of-sub-matrix-no-larger-than-kHard
364nested-list-weight-sum-ii:lock:Medium
365water-and-jug-problemMedium
366find-leaves-of-binary-tree:lock:Medium
367valid-perfect-squareMedium
368largest-divisible-subsetMedium
369plus-one-linked-list:lock:Medium
370range-addition:lock::memo:Medium
371sum-of-two-integersjavascriptEasy
372super-powMedium
373find-k-pairs-with-smallest-sumsMedium
374guess-number-higher-or-lowerjavascript:memo:Easy
375guess-number-higher-or-lower-iiMedium
376wiggle-subsequence:memo:Medium
377combination-sum-ivMedium
378kth-smallest-element-in-a-sorted-matrixMedium
379design-phone-directory:lock:Medium
380insert-delete-getrandom-o1Hard
381insert-delete-getrandom-o1-duplicates-allowedHard
382linked-list-random-nodeMedium
383ransom-notejavascriptEasy
384shuffle-an-arrayMedium
385mini-parserMedium
386lexicographical-numbersMedium
387first-unique-character-in-a-stringjavascriptEasy
388longest-absolute-file-pathMedium
389find-the-differencejavascriptEasy
390elimination-gameMedium
391perfect-rectangleHard
392is-subsequencejavascriptMedium
393utf-8-validationMedium
394decode-stringMedium
395longest-substring-with-at-least-k-repeating-charactersMedium
396rotate-functionjavascriptEasy
397integer-replacementMedium
398random-pick-indexMedium
399evaluate-divisionMedium
400nth-digitjavascriptEasy
401binary-watchjavascriptEasy
402remove-k-digitsMedium
403frog-jumpHard
404sum-of-left-leavesjavascriptEasy
405convert-a-number-to-hexadecimaljavascriptEasy
406queue-reconstruction-by-heightMedium
407trapping-rain-water-iiHard
408valid-word-abbreviation:lock:Easy
409longest-palindromejavascriptEasy
410split-array-largest-sumHard
411minimum-unique-word-abbreviation:lock:Hard
412fizz-buzzjavascriptEasy
413arithmetic-slicesMedium
414third-maximum-numberjavascriptEasy
415add-stringsjavascriptEasy
416partition-equal-subset-sumMedium
417pacific-atlantic-water-flowMedium
418sentence-screen-fitting:lock:Medium
419battleships-in-a-boardMedium
420strong-password-checkerHard
421maximum-xor-of-two-numbers-in-an-arrayMedium
422valid-word-square:lock:Easy
423reconstruct-original-digits-from-englishMedium
424longest-repeating-character-replacementMedium
425word-squares:lock:Hard
432all-oone-data-structureHard
435non-overlapping-intervalsMedium
436find-right-intervalMedium
437path-sum-iiiEasy
438find-all-anagrams-in-a-stringEasy
439ternary-expression-parser:lock:Medium
440k-th-smallest-in-lexicographical-orderHard
441arranging-coinsjavascriptEasy
444sequence-reconstruction:lock:Medium
446arithmetic-slices-ii-subsequenceHard
447number-of-boomerangsEasy
452minimum-number-of-arrows-to-burst-balloonsMedium
453minimum-moves-to-equal-array-elementsEasy
4544sum-iiMedium
455assign-cookiesEasy
456132-patternMedium
459repeated-substring-patternEasy
462minimum-moves-to-equal-array-elements-iiMedium
463island-perimeterEasy
464can-i-winMedium
465optimal-account-balancing:lock:Hard