My algorithms to fix the interviewing questions, written in Javascript(ES6).

# Problems Solutions Difficulty
001 two-sum javascript Easy
002 add-two-numbers javascript Medium
003 longest-substring-without-repeating-characters javascript Medium
004 median-of-two-sorted-arrays javascript Hard
005 longest-palindromic-substring javascript Medium
007 reverse-integer javascript Easy
009 palindrome-number javascript Easy
013 roman-to-integer javascript Easy
014 longest-common-prefix javascript Easy
017 letter-combinations-of-a-phone-number javascript Medium
020 valid-parentheses javascript Easy
021 merge-two-sorted-lists javascript Easy
022 generate-parentheses javascript Medium
026 remove-duplicates-from-sorted-array javascript Easy
027 remove-element javascript Easy
035 search-insert-position javascript Easy
036 valid-sudoku javascript Medium
039 combination-sum javascript Medium
040 combination-sum-ii javascript Medium
045 jump-game-ii javascript Hard
046 permutations javascript Medium
047 permutations-ii javascript Medium
048 rotate-image javascript Medium
049 group-anagrams javascript Medium
053 maximum-subarray javascript Easy
055 jump-game javascript Medium
056 merge-intervals javascript Medium
058 length-of-last-word javascript Easy
062 unique-paths javascript Medium
066 plus-one javascript Easy
070 climbing-stairs javascript Easy
075 sort-colors javascript Medium
077 combinations javascript Medium
078 subsets javascript Medium
083 remove-duplicates-from-sorted-list javascript Easy
090 subsets-ii javascript Medium
100 same-tree javascript Easy
101 symmetric-tree javascript Easy
104 maximum-depth-of-binary-tree javascript Easy
110 balanced-binary-tree javascript Easy
111 minimum-depth-of-binary-tree javascript Easy
112 path-sum javascript Easy
113 path-sum-ii javascript Medium
118 pascals-triangle javascript Easy
119 pascals-triangle-ii javascript Easy
121 best-time-to-buy-and-sell-stock javascript Easy
122 best-time-to-buy-and-sell-stock-ii javascript Easy
125 valid-palindrome javascript Easy
131 palindrome-partitioning javascript Medium
136 single-number javascript Easy
137 single-number-ii javascript Medium
141 linked-list-cycle javascript Easy
144 binary-tree-preorder-traversal javascript Medium
152 maximum-product-subarray javascript Medium
153 find-minimum-in-rotated-sorted-array javascript Medium
160 intersection-of-two-linked-lists javascript Easy
162 find-peak-element javascript Medium
167 two-sum-ii-input-array-is-sorted javascript Easy
169 majority-element javascript Easy
170 two-sum-iii-data-structure-design javascript Easy
171 excel-sheet-column-number javascript Easy
172 factorial-trailing-zeroes javascript Easy
189 rotate-array javascript Easy
191 number-of-1-bits javascript Easy
198 house-robber javascript Easy
200 number-of-islands javascript Medium
202 happy-number javascript Easy
203 remove-linked-list-elements javascript Easy
204 count-primes javascript Easy
205 isomorphic-strings javascript Easy
206 reverse-linked-list javascript go Easy
216 combination-sum-iii javascript Medium
217 contains-duplicate javascript Easy
219 contains-duplicate-ii javascript Easy
225 implement-stack-using-queues javascript Easy
226 invert-binary-tree javascript Easy
228 summary-ranges javascript Medium
230 kth-smallest-element-in-a-bst javascript Medium
231 power-of-two javascript Easy
232 implement-queue-using-stacks javascript Easy
234 palindrome-linked-list javascript Easy
235 lowest-common-ancestor-of-a-binary-search-tree javascript Easy
237 delete-node-in-a-linked-list javascript Easy
238 product-of-array-except-self javascript Medium
241 different-ways-to-add-parentheses javascript Medium
242 valid-anagram javascript Easy
246 strobogrammatic-number javascript Easy
252 meeting-rooms javascript Easy
253 meeting-rooms-ii javascript Medium
254 factor-combinations javascript Medium
257 binary-tree-paths javascript Easy
258 add-digits javascript Easy
260 single-number-iii javascript Medium
263 ugly-number javascript Easy
264 ugly-number-ii javascript Medium
266 palindrome-permutation javascript Easy
267 palindrome-permutation-ii javascript Medium
268 missing-number javascript Easy
270 closest-binary-search-tree-value javascript Easy
278 first-bad-version javascript Easy
279 perfect-squares javascript Medium
280 wiggle-sort javascript Medium
283 move-zeroes javascript Easy
287 find-the-duplicate-number javascript Medium
290 word-pattern javascript Easy
298 binary-tree-longest-consecutive-sequence javascript Medium
300 longest-increasing-subsequence javascript Medium
316 remove-duplicate-letters javascript Hard
326 power-of-three javascript Easy
338 counting-bits javascript Medium
340 longest-substring-with-at-most-k-distinct-characters javascript Hard
342 power-of-four javascript Easy
343 integer-break javascript Medium
344 reverse-string javascript Easy
345 reverse-vowels-of-a-string javascript Easy
346 moving-average-from-data-stream javascript Easy
347 top-k-frequent-elements javascript Medium
349 intersection-of-two-arrays javascript Easy
350 intersection-of-two-arrays-ii javascript Easy
351 android-unlock-patterns javascript Medium
359 logger-rate-limiter javascript Easy
360 sort-transformed-array javascript Medium
367 valid-perfect-square javascript Easy
369 plus-one-linked-list javascript Medium
371 sum-of-two-integers javascript Easy
377 combination-sum-iv javascript Medium
378 kth-smallest-element-in-a-sorted-matrix javascript Medium
383 ransom-note javascript Easy
384 shuffle-an-array javascript Medium
387 first-unique-character-in-a-string javascript Easy
389 find-the-difference javascript Easy
392 is-subsequence javascript Medium
394 decode-string javascript Medium
399 evaluate-division javascript Medium
401 binary-watch javascript Easy
404 sum-of-left-leaves javascript Easy
406 queue-reconstruction-by-height javascript Medium
409 longest-palindrome javascript Easy
412 fizz-buzz javascript Easy
414 third-maximum-number javascript Easy
415 add-strings javascript Easy
437 path-sum-iii javascript Easy
438 find-all-anagrams-in-a-string javascript Easy
442 find-all-duplicates-in-an-array javascript Medium
445 add-two-numbers-ii javascript Medium
448 find-all-numbers-disappeared-in-an-array javascript Easy
461 hamming-distance javascript Easy
463 island-perimeter javascript Easy
476 number-complement javascript Easy
481 magical-string javascript Medium
485 max-consecutive-ones javascript Easy
486 predict-the-winner javascript Medium
492 construct-the-rectangle javascript Easy
494 target-sum javascript Medium
500 keyboard-row javascript Easy
504 base-7 javascript Easy
506 relative-ranks javascript Easy
516 longest-palindromic-subsequence javascript Medium
520 detect-capital javascript Easy
521 longest-uncommon-subsequence-i javascript Easy
526 beautiful-arrangement javascript Medium
547 friend-circles javascript Medium
551 student-attendance-record-i javascript Easy
557 reverse-words-in-a-string-iii javascript Easy
561 array-partition-i javascript Easy
565 array-nesting javascript Medium
566 reshape-the-matrix javascript Easy
572 subtree-of-another-tree javascript Easy
575 distribute-candies javascript Easy
598 range-addition-ii javascript Easy
599 minimum-index-sum-of-two-lists javascript Easy
616 add-bold-tag-in-string javascript Medium
617 merge-two-binary-trees javascript Easy
633 sum-of-square-numbers javascript Easy
645 set-mismatch javascript Easy
647 palindromic-substrings javascript Medium
653 two-sum-iv-input-is-a-bst javascript Easy
657 judge-route-circle javascript Easy
660 remove-9 javascript Hard
686 repeated-string-match javascript Easy
687 longest-univalue-path javascript Easy
729 my-calendar-i javascript Medium

Source: github


As a programmer, algorithm lies behind the solutions and should be practiced for sure, especially for a backend developer. While I used to focus on front end world more, but I still found it a necessity at the time around 2017 March, when I was focusing on Gatsby and found it hard to contribute without neat codes. And so I started the practicing journey.



I started here cause I found it working with the command line, which suits me pretty well since I was a terminal freak. Also, the questions and testing tools were in the place I could see makes it fun to try. It was a good place to start, but I still moved pass it cause the community there wasn’t the best.


The second place I practiced on is Codewars, even that was not the first place in my mind. But after a little research, I found it an excellent place to play with since they got online testing and probably the best Javascript algorithm community. It was a kind of enlightenment, and I learn a lot from other programmers’ codes. After finishing 125 questions, I ended up my journey with top 4% ranking, I didn’t know it was that high, but I did stagnant for a while for the difficulty up there was a little bit crazy to me. Also, the test cases there was not that good; Sometimes, I need to write my test cases with the chosen test engine(Jasmine I guess), that was a piece of experience, but I did like it, I am more of a single threaded person and wanted to focus on the algorithm.


Leetcode must be the most serious and well-known algorithm practicing website I have ever seen. You can not believe how popular this website is in my Chinese fellows’ world. And it deserves it: the community there was everything about better algorithms and real world interview questions. Although the people were a little bit too focused on Java and Cpp (for the best practice of finding a job for sure), the people there are unbelievable, and I had some really good practices there.


Tagged withjavascript, leetcode, algorithm

Questions, Comments, Suggestions?Open an Issue