leetcode.js A repository of my leetcode solutions. What are here Solve leetcode problems. Problems # 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 9 Palindrome Number JavaScript Easy 10 Regular Expression Matching JavaScript Hard 11 Container With Most Water JavaScript Medium 12 Integer to Roman Medium 13 Roman to Integer 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 18 4Sum JavaScript Medium 19 Remove Nth Node From End of List JavaScript Medium 20 Valid Parentheses JavaScript Easy 21 Merge Two Sorted Lists JavaScript Easy 22 Generate Parentheses JavaScript Medium 23 Merge k Sorted Lists JavaScript Hard 24 Swap Nodes in Pairs Medium 25 Reverse Nodes in k-Group JavaScript Hard 26 Remove Duplicates from Sorted Array Easy 27 Remove Element Easy 28 Implement strStr() Easy 29 Divide Two Integers JavaScript Medium 30 Substring with Concatenation of All Words Hard 31 Next Permutation JavaScript Medium 32 Longest Valid Parentheses JavaScript Hard 33 Search in Rotated Sorted Array JavaScript Medium 34 Find First and Last Position of Element in Sorted Array JavaScript Medium 35 Search Insert Position JavaScript Easy 36 Valid Sudoku JavaScript Medium 37 Sudoku Solver JavaScript Hard 38 Count and Say 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 44 Wildcard Matching JavaScript Hard 45 Jump Game II JavaScript Hard 46 Permutations JavaScript Medium 47 Permutations II JavaScript Medium 48 Rotate Image JavaScript Medium 49 Group Anagrams JavaScript Medium 50 Pow(x, n) JavaScript Medium 51 N-Queens JavaScript Hard 52 N-Queens II JavaScript Hard 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 58 Length of Last Word JavaScript Easy 59 Spiral Matrix II JavaScript Medium 60 Permutation Sequence JavaScript Medium 61 Rotate List Medium 62 Unique Paths Medium 63 Unique Paths II Medium 64 Minimum Path Sum JavaScript Medium 65 Valid Number JavaScript Hard 66 Plus One Easy 67 Add Binary Easy 68 Text Justification Hard 69 Sqrt(x) Easy 70 Climbing Stairs Easy 71 Simplify Path Medium 72 Edit Distance JavaScript Hard 73 Set Matrix Zeroes Medium 74 Search a 2D Matrix Medium 75 Sort Colors Medium 76 Minimum Window Substring Hard 77 Combinations JavaScript Medium 78 Subsets Medium 79 Word Search Medium 80 Remove Duplicates from Sorted Array II Medium 81 Search in Rotated Sorted Array II JavaScript Medium 82 Remove Duplicates from Sorted List II Medium 83 Remove Duplicates from Sorted List Easy 84 Largest Rectangle in Histogram JavaScript Hard 85 Maximal Rectangle JavaScript Hard 86 Partition List Medium 87 Scramble String JavaScript Hard 88 Merge Sorted Array Easy 89 Gray Code Medium 90 Subsets II JavaScript Medium 91 Decode Ways JavaScript Medium 92 Reverse Linked List II Medium 93 Restore IP Addresses Medium 94 Binary Tree Inorder Traversal JavaScript Medium 95 Unique Binary Search Trees II Medium 96 Unique Binary Search Trees Medium 97 Interleaving String JavaScript Hard 98 Validate Binary Search Tree JavaScript Medium 99 Recover Binary Search Tree JavaScript Hard 100 Same Tree Easy 101 Symmetric Tree JavaScript Easy 102 Binary Tree Level Order Traversal JavaScript Medium 103 Binary Tree Zigzag Level Order Traversal JavaScript Medium 104 Maximum Depth of Binary Tree JavaScript Easy 105 Construct Binary Tree from Preorder and Inorder Traversal JavaScript Medium 106 Construct Binary Tree from Inorder and Postorder Traversal JavaScript Medium 107 Binary Tree Level Order Traversal II JavaScript Easy 108 Convert Sorted Array to Binary Search Tree JavaScript Easy 109 Convert Sorted List to Binary Search Tree JavaScript Medium 110 Balanced Binary Tree JavaScript Easy 111 Minimum Depth of Binary Tree JavaScript Easy 112 Path Sum Easy 113 Path Sum II JavaScript Medium 114 Flatten Binary Tree to Linked List JavaScript Medium 115 Distinct Subsequences Hard 116 Populating Next Right Pointers in Each Node Medium 117 Populating Next Right Pointers in Each Node II Medium 118 Pascal's Triangle Easy 119 Pascal's Triangle II Easy 120 Triangle Medium 121 Best Time to Buy and Sell Stock Easy 122 Best Time to Buy and Sell Stock II Easy 123 Best Time to Buy and Sell Stock III Hard 124 Binary Tree Maximum Path Sum JavaScript Hard 125 Valid Palindrome Easy 126 Word Ladder II Hard 127 Word Ladder Medium 128 Longest Consecutive Sequence JavaScript Hard 129 Sum Root to Leaf Numbers Medium 130 Surrounded Regions Medium 131 Palindrome Partitioning Medium 132 Palindrome Partitioning II Hard 133 Clone Graph Medium 134 Gas Station JavaScript Medium 135 Candy Hard 136 Single Number Easy 137 Single Number II Medium 138 Copy List with Random Pointer Medium 139 Word Break Medium 140 Word Break II Hard 141 Linked List Cycle Easy 142 Linked List Cycle II Medium 143 Reorder List Medium 144 Binary Tree Preorder Traversal JavaScript Medium 145 Binary Tree Postorder Traversal JavaScript Hard 146 LRU Cache JavaScript Hard 147 Insertion Sort List Medium 148 Sort List Medium 149 Max Points on a Line Hard 150 Evaluate Reverse Polish Notation Medium 151 Reverse Words in a String JavaScript Medium 152 Maximum Product Subarray Medium 153 Find Minimum in Rotated Sorted Array Medium 154 Find Minimum in Rotated Sorted Array II Hard 155 Min Stack Easy 156 Binary Tree Upside Down Medium 157 Read N Characters Given Read4 Easy 158 Read N Characters Given Read4 II - Call multiple times Hard 159 Longest Substring with At Most Two Distinct Characters Hard 160 Intersection of Two Linked Lists Easy 161 One Edit Distance Medium 162 Find Peak Element Medium 163 Missing Ranges Medium 164 Maximum Gap Hard 165 Compare Version Numbers Medium 166 Fraction to Recurring Decimal Medium 167 Two Sum II - Input array is sorted Easy 168 Excel Sheet Column Title Easy 169 Majority Element Easy 170 Two Sum III - Data structure design Easy 171 Excel Sheet Column Number Easy 172 Factorial Trailing Zeroes Easy 173 Binary Search Tree Iterator Medium 174 Dungeon Game Hard 175 Combine Two Tables Easy 176 Second Highest Salary Easy 177 Nth Highest Salary Medium 178 Rank Scores Medium 179 Largest Number Medium 180 Consecutive Numbers Medium 181 Employees Earning More Than Their Managers Easy 182 Duplicate Emails Easy 183 Customers Who Never Order Easy 184 Department Highest Salary Medium 185 Department Top Three Salaries Hard 186 Reverse Words in a String II Medium 187 Repeated DNA Sequences Medium 188 Best Time to Buy and Sell Stock IV Hard 189 Rotate Array Easy 190 Reverse Bits Easy 191 Number of 1 Bits Easy 192 Word Frequency Medium 193 Valid Phone Numbers Easy 194 Transpose File Medium 195 Tenth Line Easy 196 Delete Duplicate Emails Easy 197 Rising Temperature Easy 198 House Robber Easy 199 Binary Tree Right Side View Medium 200 Number of Islands Medium