Leetcope
Leetcode solutions in JavaScript. Most of them are within the top 90% of JavaScript runtime distribution (2018).
Templates are generated via Leetmark.
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Difficulty
Easy
- 001. Two Sum.md
- 007. Reverse Integer.md
- 009. Palindrome Number.md
- 013. Roman to Integer.md
- 014. Longest Common Prefix.md
- 020. Valid Parentheses.md
- 021. Merge Two Sorted Lists.md
- 026. Remove Duplicates from Sorted Array.md
- 027. Remove Element.md
- 028. Implement strStr().md
- 035. Search Insert Position.md
- 038. Count and Say.md
- 053. Maximum Subarray.md
- 058. Length of Last Word.md
- 066. Plus One.md
- 067. Add Binary.md
- 069. Sqrt(x).md
- 070. Climbing Stairs.md
- 083. Remove Duplicates from Sorted List.md
- 088. Merge Sorted Array.md
- 100. Same Tree.md
- 101. Symmetric Tree.md
- 104. Maximum Depth of Binary Tree.md
- 107. Binary Tree Level Order Traversal II.md
- 108. Convert Sorted Array to Binary Search Tree.md
- 110. Balanced Binary Tree.md
- 111. Minimum Depth of Binary Tree.md
- 112. Path Sum.md
- 118. Pascal's Triangle.md
- 119. Pascal's Triangle II.md
- 121. Best Time to Buy and Sell Stock.md
- 122. Best Time to Buy and Sell Stock II.md
- 125. Valid Palindrome.md
Medium
- 002. Add Two Numbers.md
- 003. Longest Substring Without Repeating Characters.md
- 005. Longest Palindromic Substring.md
- 006. ZigZag Conversion.md
- 008. String to Integer (atoi).md
- 011. Container With Most Water.md
- 012. Integer to Roman.md
- 015. 3Sum.md
- 016. 3Sum Closest.md
- 017. Letter Combinations of a Phone Number.md
- 018. 4Sum.md
- 019. Remove Nth Node From End of List.md
- 022. Generate Parentheses.md
- 024. Swap Nodes in Pairs.md
- 029. Divide Two Integers.md
- 031. Next Permutation.md
- 033. Search in Rotated Sorted Array.md
- 034. Find First and Last Position of Element in Sorted Array.md
- 036. Valid Sudoku.md
- 039. Combination Sum.md
- 040. Combination Sum II.md
- 043. Multiply Strings.md
- 046. Permutations.md
- 047. Permutations II.md
- 048. Rotate Image.md
- 049. Group Anagrams.md
- 050. Pow(x, n).md
- 054. Spiral Matrix.md
- 055. Jump Game.md
- 056. Merge Intervals.md
- 059. Spiral Matrix II.md
- 060. Permutation Sequence.md
- 061. Rotate List.md
- 062. Unique Paths.md
- 063. Unique Paths II.md
- 064. Minimum Path Sum.md
- 071. Simplify Path.md
- 073. Set Matrix Zeroes.md
- 074. Search a 2D Matrix.md
- 075. Sort Colors.md
- 077. Combinations.md
- 078. Subsets.md
- 079. Word Search.md
- 080. Remove Duplicates from Sorted Array II.md
- 081. Search in Rotated Sorted Array II.md
- 082. Remove Duplicates from Sorted List II.md
- 086. Partition List.md
- 089. Gray Code.md
- 090. Subsets II.md
- 091. Decode Ways.md
- 092. Reverse Linked List II.md
- 093. Restore IP Addresses.md
- 094. Binary Tree Inorder Traversal.md
- 095. Unique Binary Search Trees II.md
- 096. Unique Binary Search Trees.md
- 098. Validate Binary Search Tree.md
- 102. Binary Tree Level Order Traversal.md
- 103. Binary Tree Zigzag Level Order Traversal.md
- 105. Construct Binary Tree from Preorder and Inorder Traversal.md
- 106. Construct Binary Tree from Inorder and Postorder Traversal.md
- 109. Convert Sorted List to Binary Search Tree.md
- 113. Path Sum II.md
- 114. Flatten Binary Tree to Linked List.md
- 116. Populating Next Right Pointers in Each Node.md
- 117. Populating Next Right Pointers in Each Node II.md
- 120. Triangle.md
- 127. Word Ladder.md
- 129. Sum Root to Leaf Numbers.md
- 130. Surrounded Regions.md
- 131. Palindrome Partitioning.md
- 133. Clone Graph.md
Hard
- 004. Median of Two Sorted Arrays.md
- 010. Regular Expression Matching.md
- 023. Merge k Sorted Lists.md
- 025. Reverse Nodes in k-Group.md
- 030. Substring with Concatenation of All Words.md
- 032. Longest Valid Parentheses.md
- 037. Sudoku Solver.md
- 041. First Missing Positive.md
- 042. Trapping Rain Water.md
- 044. Wildcard Matching.md
- 045. Jump Game II.md
- 051. N-Queens.md
- 052. N-Queens II.md
- 057. Insert Interval.md
- 065. Valid Number.md
- 068. Text Justification.md
- 072. Edit Distance.md
- 076. Minimum Window Substring.md
- 084. Largest Rectangle in Histogram.md
- 085. Maximal Rectangle.md
- 087. Scramble String.md
- 097. Interleaving String.md
- 099. Recover Binary Search Tree.md
- 115. Distinct Subsequences.md
- 123. Best Time to Buy and Sell Stock III.md
- 124. Binary Tree Maximum Path Sum.md
- 126. Word Ladder II.md
- 128. Longest Consecutive Sequence.md
- 132. Palindrome Partitioning II.md
Related Topics
Array
- 001. Two Sum.md
- 004. Median of Two Sorted Arrays.md
- 011. Container With Most Water.md
- 015. 3Sum.md
- 016. 3Sum Closest.md
- 018. 4Sum.md
- 026. Remove Duplicates from Sorted Array.md
- 027. Remove Element.md
- 031. Next Permutation.md
- 033. Search in Rotated Sorted Array.md
- 034. Find First and Last Position of Element in Sorted Array.md
- 035. Search Insert Position.md
- 039. Combination Sum.md
- 040. Combination Sum II.md
- 041. First Missing Positive.md
- 042. Trapping Rain Water.md
- 045. Jump Game II.md
- 048. Rotate Image.md
- 053. Maximum Subarray.md
- 054. Spiral Matrix.md
- 055. Jump Game.md
- 056. Merge Intervals.md
- 057. Insert Interval.md
- 059. Spiral Matrix II.md
- 062. Unique Paths.md
- 063. Unique Paths II.md
- 064. Minimum Path Sum.md
- 066. Plus One.md
- 073. Set Matrix Zeroes.md
- 074. Search a 2D Matrix.md
- 075. Sort Colors.md
- 078. Subsets.md
- 079. Word Search.md
- 080. Remove Duplicates from Sorted Array II.md
- 081. Search in Rotated Sorted Array II.md
- 084. Largest Rectangle in Histogram.md
- 085. Maximal Rectangle.md
- 088. Merge Sorted Array.md
- 090. Subsets II.md
- 105. Construct Binary Tree from Preorder and Inorder Traversal.md
- 106. Construct Binary Tree from Inorder and Postorder Traversal.md
- 118. Pascal's Triangle.md
- 119. Pascal's Triangle II.md
- 120. Triangle.md
- 121. Best Time to Buy and Sell Stock.md
- 122. Best Time to Buy and Sell Stock II.md
- 123. Best Time to Buy and Sell Stock III.md
- 126. Word Ladder II.md
- 128. Longest Consecutive Sequence.md
Backtracking
- 010. Regular Expression Matching.md
- 017. Letter Combinations of a Phone Number.md
- 022. Generate Parentheses.md
- 037. Sudoku Solver.md
- 039. Combination Sum.md
- 040. Combination Sum II.md
- 044. Wildcard Matching.md
- 046. Permutations.md
- 047. Permutations II.md
- 051. N-Queens.md
- 052. N-Queens II.md
- 060. Permutation Sequence.md
- 077. Combinations.md
- 078. Subsets.md
- 079. Word Search.md
- 089. Gray Code.md
- 090. Subsets II.md
- 093. Restore IP Addresses.md
- 126. Word Ladder II.md
- 131. Palindrome Partitioning.md
Binary Search
- 004. Median of Two Sorted Arrays.md
- 029. Divide Two Integers.md
- 033. Search in Rotated Sorted Array.md
- 034. Find First and Last Position of Element in Sorted Array.md
- 035. Search Insert Position.md
- 050. Pow(x, n).md
- 069. Sqrt(x).md
- 074. Search a 2D Matrix.md
- 081. Search in Rotated Sorted Array II.md
Bit Manipulation
Breadth-first Search
Depth-first Search
- 098. Validate Binary Search Tree.md
- 099. Recover Binary Search Tree.md
- 100. Same Tree.md
- 101. Symmetric Tree.md
- 104. Maximum Depth of Binary Tree.md
- 105. Construct Binary Tree from Preorder and Inorder Traversal.md
- 106. Construct Binary Tree from Inorder and Postorder Traversal.md
- 108. Convert Sorted Array to Binary Search Tree.md
- 109. Convert Sorted List to Binary Search Tree.md
- 110. Balanced Binary Tree.md
- 111. Minimum Depth of Binary Tree.md
- 112. Path Sum.md
- 113. Path Sum II.md
- 114. Flatten Binary Tree to Linked List.md
- 116. Populating Next Right Pointers in Each Node.md
- 117. Populating Next Right Pointers in Each Node II.md
- 124. Binary Tree Maximum Path Sum.md
- 129. Sum Root to Leaf Numbers.md
- 130. Surrounded Regions.md
- 133. Clone Graph.md
Divide and Conquer
Dynamic Programming
- 005. Longest Palindromic Substring.md
- 010. Regular Expression Matching.md
- 032. Longest Valid Parentheses.md
- 044. Wildcard Matching.md
- 053. Maximum Subarray.md
- 062. Unique Paths.md
- 063. Unique Paths II.md
- 064. Minimum Path Sum.md
- 070. Climbing Stairs.md
- 072. Edit Distance.md
- 085. Maximal Rectangle.md
- 087. Scramble String.md
- 091. Decode Ways.md
- 095. Unique Binary Search Trees II.md
- 096. Unique Binary Search Trees.md
- 097. Interleaving String.md
- 115. Distinct Subsequences.md
- 120. Triangle.md
- 121. Best Time to Buy and Sell Stock.md
- 123. Best Time to Buy and Sell Stock III.md
- 132. Palindrome Partitioning II.md
Graph
Greedy
Hash Table
Linked List
- 002. Add Two Numbers.md
- 019. Remove Nth Node From End of List.md
- 021. Merge Two Sorted Lists.md
- 023. Merge k Sorted Lists.md
- 024. Swap Nodes in Pairs.md
- 025. Reverse Nodes in k-Group.md
- 061. Rotate List.md
- 082. Remove Duplicates from Sorted List II.md
- 083. Remove Duplicates from Sorted List.md
- 086. Partition List.md
- 092. Reverse Linked List II.md
- 109. Convert Sorted List to Binary Search Tree.md
Math
- 002. Add Two Numbers.md
- 007. Reverse Integer.md
- 008. String to Integer (atoi).md
- 009. Palindrome Number.md
- 012. Integer to Roman.md
- 013. Roman to Integer.md
- 029. Divide Two Integers.md
- 043. Multiply Strings.md
- 050. Pow(x, n).md
- 060. Permutation Sequence.md
- 065. Valid Number.md
- 066. Plus One.md
- 067. Add Binary.md
- 069. Sqrt(x).md
Stack
String
- 003. Longest Substring Without Repeating Characters.md
- 005. Longest Palindromic Substring.md
- 006. ZigZag Conversion.md
- 008. String to Integer (atoi).md
- 010. Regular Expression Matching.md
- 012. Integer to Roman.md
- 013. Roman to Integer.md
- 014. Longest Common Prefix.md
- 017. Letter Combinations of a Phone Number.md
- 020. Valid Parentheses.md
- 022. Generate Parentheses.md
- 028. Implement strStr().md
- 030. Substring with Concatenation of All Words.md
- 032. Longest Valid Parentheses.md
- 038. Count and Say.md
- 043. Multiply Strings.md
- 044. Wildcard Matching.md
- 049. Group Anagrams.md
- 058. Length of Last Word.md
- 065. Valid Number.md
- 067. Add Binary.md
- 068. Text Justification.md
- 071. Simplify Path.md
- 072. Edit Distance.md
- 076. Minimum Window Substring.md
- 087. Scramble String.md
- 091. Decode Ways.md
- 093. Restore IP Addresses.md
- 097. Interleaving String.md
- 115. Distinct Subsequences.md
- 125. Valid Palindrome.md
- 126. Word Ladder II.md
Tree
- 094. Binary Tree Inorder Traversal.md
- 095. Unique Binary Search Trees II.md
- 096. Unique Binary Search Trees.md
- 098. Validate Binary Search Tree.md
- 099. Recover Binary Search Tree.md
- 100. Same Tree.md
- 101. Symmetric Tree.md
- 102. Binary Tree Level Order Traversal.md
- 103. Binary Tree Zigzag Level Order Traversal.md
- 104. Maximum Depth of Binary Tree.md
- 105. Construct Binary Tree from Preorder and Inorder Traversal.md
- 106. Construct Binary Tree from Inorder and Postorder Traversal.md
- 107. Binary Tree Level Order Traversal II.md
- 108. Convert Sorted Array to Binary Search Tree.md
- 110. Balanced Binary Tree.md
- 111. Minimum Depth of Binary Tree.md
- 112. Path Sum.md
- 113. Path Sum II.md
- 114. Flatten Binary Tree to Linked List.md
- 116. Populating Next Right Pointers in Each Node.md
- 117. Populating Next Right Pointers in Each Node II.md
- 124. Binary Tree Maximum Path Sum.md
- 129. Sum Root to Leaf Numbers.md
Two Pointers
- 003. Longest Substring Without Repeating Characters.md
- 011. Container With Most Water.md
- 015. 3Sum.md
- 016. 3Sum Closest.md
- 018. 4Sum.md
- 019. Remove Nth Node From End of List.md
- 026. Remove Duplicates from Sorted Array.md
- 027. Remove Element.md
- 028. Implement strStr().md
- 030. Substring with Concatenation of All Words.md
- 042. Trapping Rain Water.md
- 061. Rotate List.md
- 075. Sort Colors.md
- 076. Minimum Window Substring.md
- 080. Remove Duplicates from Sorted Array II.md
- 086. Partition List.md
- 088. Merge Sorted Array.md
- 125. Valid Palindrome.md