/LeetCode-with-JavaScript

Solutions collection of my LeetCode submissions in JavaScript (LeetCode 解题集之 JavaScript 版)

Primary LanguageJavaScriptApache License 2.0Apache-2.0

LeetCode in JavaScript

This is the solutions collection of my LeetCode submissions, most of them are programmed in JavaScript. All JavaScript codes are wrote in ECMAScript 6 standard, each solution file will contain a problem description in the beginning, and followed by some necessary explanation, some problems will provide more than one solution, please refer to the comments after the main solution for one specific problem.

ATTENTION: If you also use JavaScript as your coding language, you should pay attention to some JavaScript INTERNAL issues, such as bitwise operators, so as to let you not drop into some trouble which may be caused by JavaScript itself.

Progress: 127 Solutions

ID Title Solution Difficulty
1 Two Sum JavaScript Easy
2 Add Two Numbers JavaScript Medium
3 Longest Substring Without Repeating Characters JavaScript Medium
4 Median of Two Sorted Arrays JavaScript Hard
5 Longest Palindromic Substring JavaScript Medium
6 ZigZag Conversion JavaScript Medium
7 Reverse Integer JavaScript Easy
8 String to Integer (atoi) JavaScript Medium
11 Container With Most Water JavaScript Medium
13 Roman to Integer JavaScript Easy
14 Longest Common Prefix JavaScript Easy
15 3Sum JavaScript Medium
16 3Sum Closest JavaScript Medium
17 Letter Combinations of a Phone Number JavaScript Medium
19 Remove Nth Node From End of List JavaScript Medium
22 Generate Parentheses JavaScript Medium
26 Remove Duplicates from Sorted Array JavaScript Easy
27 Remove Element JavaScript Easy
28 Implement strStr() JavaScript Easy
29 Divide Two Integers JavaScript Medium
33 Search in Rotated Sorted Array JavaScript Medium
34 Search for a Range JavaScript Medium
35 Search Insert Position JavaScript Easy
39 Combination Sum JavaScript Medium
40 Combination Sum II JavaScript Medium
41 First Missing Positive JavaScript Hard
42 Trapping Rain Water JavaScript Hard
43 Multiply Strings JavaScript Medium
45 Jump Game II JavaScript Hard
46 Permutations JavaScript Medium
48 Rotate Image JavaScript Medium
49 Group Anagrams JavaScript Medium
53 Maximum Subarray JavaScript Easy
54 Spiral Matrix JavaScript Medium
55 Jump Game * JavaScript Medium
56 Merge Intervals JavaScript Medium
57 Insert Interval JavaScript Hard
62 Unique Paths JavaScript Medium
63 Unique Paths ii JavaScript Medium
66 Plus One JavaScript Easy
69 Sqrt(x) JavaScript Easy
71 Simplify Path JavaScript Medium
73 Set Matrix Zeroes JavaScript Medium
75 Sort Colors JavaScript Medium
80 Remove Duplicates from Sorted Array II JavaScript Medium
81 Search in Rotated Sorted Array II JavaScript Medium
88 Merge Sorted Array JavaScript Medium
91 Decode Ways JavaScript Medium
93 Restore IP Addresses JavaScript Medium
98 Validate Binary Search Tree JavaScript Medium
100 Same Tree JavaScript Easy
101 Symmetric Tree JavaScript Easy
102 Binary Tree Level Order Traversal JavaScript Medium
104 Maximum Depth of Binary Tree JavaScript Easy
107 Binary Tree Level Order Traversal II JavaScript Easy
108 Convert Sorted Array to Binary Search Tree JavaScript Easy
111 Minimum Depth of Binary Tree JavaScript Easy
120 Triangle JavaScript Medium
121 Best Time to Buy and Sell Stock JavaScript Easy
122 Best Time to Buy and Sell Stock II JavaScript Easy
123 Best Time to Buy and Sell Stock III * JavaScript Hard
127 Word Ladder JavaScript Medium
128 Longest Consecutive Sequence JavaScript Medium
130 Surrounded Regions JavaScript Medium
133 Clone Graph JavaScript Medium
134 Gas Station JavaScript Medium
135 Candy JavaScript Hard
136 Single Number JavaScript Easy
137 Single Number II JavaScript Medium
151 Reverse Words in a String JavaScript Medium
152 Maximum Product Subarray JavaScript Medium
153 Find Minimum in Rotated Sorted Array JavaScript Medium
154 Find Minimum in Rotated Sorted Array II JavaScript Medium
162 Find Peak Element JavaScript Medium
164 Maximum Gap JavaScript Hard
165 Compare Version Numbers JavaScript Medium
169 Majority Element JavaScript Easy
175 Combine Two Tables SQL Easy
176 Second Highest Salary SQL Easy
177 Nth Highest Salary SQL Medium
181 Employees Earning More Than Their Managers SQL Easy
182 Duplicate Emails SQL Easy
183 Customers Who Never Order SQL Easy
184 Department Highest Salary SQL Medium
188 Best Time to Buy and Sell Stock IV JavaScript Hard
189 Rotate Array JavaScript Easy
190 Reverse Bits JavaScript Easy
196 Delete Duplicate Emails SQL Easy
197 Rising Temperature SQL Easy
206 Reverse Linked List JavaScript Easy
207 Course Schedule JavaScript Medium
209 Minimum Size Subarray Sum JavaScript Medium
210 Course Schedule II JavaScript Medium
215 Kth Largest Element in an Array JavaScript Medium
217 Contains Duplicate JavaScript Easy
219 Contains Duplicate II JavaScript Easy
220 Contains Duplicate III JavaScript Medium
228 Summary Ranges JavaScript Medium
238 Product of Array Except Self JavaScript Medium
239 Sliding Window Maximum JavaScript Hard
240 Search a 2D Matrix II JavaScript Medium
274 H-Index JavaScript Medium
275 H-Index II JavaScript Medium
278 First Bad Version JavaScript Easy
283 Move Zeroes JavaScript Easy
287 Find the Duplicate Number JavaScript Medium
289 Game of Life JavaScript Medium
295 Find Median from Data Stream JavaScript Hard
299 Bulls and Cows JavaScript Medium
300 Longest Increasing Subsequence JavaScript Medium
307 Range Sum Query - Mutable JavaScript Medium
309 Best Time to Buy and Sell Stock with Cooldown JavaScript Medium
310 Minimum Height Trees JavaScript Medium
315 Count of Smaller Numbers After Self * JavaScript Hard
322 Coin Change JavaScript Medium
327 Count of Range Sum JavaScript Hard
334 Increasing Triplet Subsequence JavaScript Medium
340 Longest Substring with At Most K Distinct Characters JavaScript Hard
342 Power of Four JavaScript Easy
344 Reverse String JavaScript Easy
349 Intersection of Two Arrays JavaScript Easy
350 Intersection of Two Arrays ii JavaScript Easy
371 Sum of Two Integers JavaScript Easy
374 Guess Number Higher or Lower JavaScript Easy
376 Wiggle Subsequence JavaScript Medium
384 Shuffle an Array JavaScript Medium
395 Longest Substring with At Least K Repeating Characters JavaScript Medium
404 Sum of Left Leaves JavaScript Easy
413 Arithmetic Slices JavaScript Medium
416 Partition Equal Subset Sum JavaScript Medium
424 Longest Repeating Character Replacement JavaScript Medium
434 Number of Segments in a String JavaScript Easy
486 Predict the Winner JavaScript Medium
494 Target Sum JavaScript Medium
516 Longest Palindromic Subsequence JavaScript Medium
523 Continuous Subarray Sum JavaScript Medium
539 Minimum Time Difference JavaScript Medium
687 Longest Univalue Path JavaScript Easy
779 K-th Symbol in Grammar JavaScript Medium