LeetCode Solution in Java
- Math
- Bit
- Array/String
- Linked List
- Hash Table
- Stack/Queue
- Tree
- Heap
- Graph
- Greedy
- Backtracking
- Divide and Conquer
- Dynamic Programming
- Trie
- Design
# | Title | Solution | Difficulty |
---|---|---|---|
8 | Reverse Integer | Java | Easy |
9 | Palindrome Number | Java | Easy |
43 | Multiply Strings (Classic) | Java | Medium |
50 | Pow(x, n) | Java | Medium |
66 | Plus One | Java | Easy |
67 | Add Binary | Java | Easy |
204 | Count Primes | Java | Easy |
415 | Add Strings | Java | Easy |
989 | Add to Array-Form of Integer | Java | Easy |
1232 | Check If It Is a Straight Line | Java | Easy |
# | Title | Solution | Difficulty |
---|---|---|---|
136 | Single Number | Java | Easy |
190 | Reverse Bit | Java | Easy |
191 | Number of 1 Bits | Java | Easy |
231 | Power of Two | Java | Easy |
371 | Sum of Two Integers | Java | Medium |
389 | Find the Difference | Java | Easy |
461 | Hamming Distance | Java | Easy |
477 | Total Hamming Distance | Java | Medium |
# | Title | Solution | Difficulty |
---|---|---|---|
11 | Container With Most Water | Java | Medium |
26 | Remove Duplicates from Sorted Array | Java | Easy |
27 | Remove Element | Java | Easy |
42 | Trapping Rain Water (Classic) | Java | Hard |
80 | Remove Duplicates from Sorted Array II (Classic) | Java | Medium |
75 | Sort Colors | Java | Medium |
125 | Valid Palindrome | Java | Easy |
283 | Move Zeroes | Java | Easy |
344 | Reverse String | Java | Easy |
845 | Longest Mountain in Array | Java | Medium |
1119 | Remove Vowels from a String | Java | Easy |
# | Title | Solution | Difficulty |
---|---|---|---|
3 | Longest Substring Without Repeating Characters | Java | Medium |
76 | Minimum Window Substring (Classic) | Java | Hard |
209 | Minimum Size Subarray Sum | Java | Medium |
487 | Max Consecutive Ones II | Java | Medium |
567 | Permutation in String (Classic) | Java | Medium |
643 | Maximum Average Subarray I | Java | Easy |
1004 | Max Consecutive Ones III | Java | Medium |
1151 | Minimum Swaps to Group All 1's Together (Classic) | Java | Medium |
# | Title | Solution | Difficulty |
---|---|---|---|
36 | Valid Sudoku | Java | Medium |
48 | Rotate Image (Classic) | Java | Medium |
54 | Spiral Matrix (Classic) | Java | Medium |
59 | Spiral Matrix II | Java | Medium |
73 | Set Matrix Zeroes (Classic) | Java | Medium |
74 | Search a 2D Matrix | Java | Medium |
130 | Surrounded Regions | Java | Medium |
200 | Number of Islands | Java | Medium |
240 | Search a 2D Matrix II | Java | Medium |
463 | Island Perimeter | Java | Easy |
498 | Diagonal Traverse | Java | Medium |
529 | Minesweeper | Java | Medium |
695 | Max Area of Island | Java | Medium |
733 | Flood Fill | Java | Easy |
867 | Transpose Matrix | Java | Easy |
994 | Rotting Oranges | Java | Medium |
1034 | Coloring A Border | Java | Medium |
# | Title | Solution | Difficulty |
---|---|---|---|
2 | Add Two Numbers | Java | Medium |
19 | Remove Nth Node From End of List | Java | Medium |
21 | Merge Two Sorted Lists | Java | Easy |
25 | Reverse Nodes in k-Group (Classic) | Java | Hard |
82 | Remove Duplicates from Sorted List II (Classic) | Java | Medium |
83 | Remove Duplicates from Sorted List (Classic) | Java | Easy |
138 | Copy List with Random Pointer (Classic) | Java | Medium |
141 | Linked List Cycle | Java | Easy |
142 | Linked List Cycle II | Java | Medium |
143 | Reorder List | Java | Medium |
147 | Insertion Sort List | Java | Medium |
148 | Sort List | Java | Medium |
160 | Intersection of Two Linked Lists | Java | Easy |
203 | Remove Linked List Elements | Java | Easy |
206 | Reverse Linked List | Java | Easy |
234 | Palindrome Linked List (Classic) | Java | Easy |
328 | Odd Even Linked List | Java | Medium |
445 | Add Two Numbers II | Java | Medium |
707 | Design Linked List | Java | Medium |
876 | Middle of the Linked List | Java | Easy |
1265 | Print Immutable Linked List in Reverse | Java | Easy |
# | Title | Solution | Difficulty |
---|---|---|---|
41 | First Missing Positive (Classic) | Java | Hard |
49 | Group Anagrams | Java | Medium |
128 | Longest Consecutive Sequence | Java | Hard |
205 | Isomorphic Strings | Java | Easy |
242 | Valid Anagram | Java | Easy |
290 | Word Pattern | Java | Easy |
554 | Brick Wall | Java | Medium |
560 | Subarray Sum Equals K (Classic) | Java | Medium |
771 | Jewels and Stones | Java | Easy |
888 | Fair Candy Swap | Java | Easy |
1122 | Relative Sort Array | Java | Easy |
# | Title | Solution | Difficulty |
---|---|---|---|
20 | Valid Parentheses | Java | Easy |
71 | Simplify Path | Java | Medium |
84 | Largest Rectangle in Histogram (Classic) | Java | Hard |
155 | Min Stack | Java | Easy |
224 | Basic Calculator (Classic) | Java | Hard |
227 | Basic Calculator II (Classic) | Java | Medium |
225 | Implement Stack using Queues | Java | Easy |
232 | Implement Queue using Stacks | Java | Easy |
394 | Decode String (Classic) | Java | Medium |
739 | Daily Temperatures | Java | Medium |
946 | Validate Stack Sequences (Classic) | Java | Medium |
1047 | Remove All Adjacent Duplicates In String | Java | Easy |
Important
# | Title | Solution | Difficulty |
---|---|---|---|
23 | Merge k Sorted Lists (Classic) | Java | Hard |
215 | Kth Largest Element in an Array | Java | Medium |
239 | Sliding Window Maximum (Classic) | Java | Hard |
295 | Find Median from Data Stream (Classic) | Java | Hard |
347 | Top K Frequent Elements (Classic) | Java | Medium |
703 | Kth Largest Element in a Stream | Java | Easy |
973 | K Closest Points to Origin | Java | Medium |
1046 | Last Stone Weight | Java | Easy |
# | Title | Solution | Difficulty |
---|---|---|---|
261 | Graph Valid Tree | Java | Medium |
323 | Number of Connected Components in an Undirected Graph | Java | Medium |
# | Title | Solution | Difficulty |
---|---|---|---|
45 | Jump Game II | Java | Medium |
55 | Jump Game | Java | Medium |
763 | Partition Labels | Java |
# | Title | Solution | Difficulty |
---|---|---|---|
17 | Letter Combinations of a Phone Number | Java | Medium |
22 | Generate Parentheses | Java | Medium |
37 | Sudoku Solver (Classic) | Java | Hard |
39 | Combination Sum | Java | Medium |
40 | Combination Sum II (Classic) | Java | Medium |
46 | Permutations | Java | Medium |
47 | Permutations II (Classic) | Java | Medium |
51 | N-Queens (Classic) | Java | Hard |
77 | Combinations | Java | Medium |
78 | Subsets | Java | Medium |
79 | Word Search | Java | Medium |
90 | Subsets II (Classic) | Java | Medium |
93 | Restore IP Addresses (Classic) | Java | Medium |
113 | Path Sum II | Java | Medium |
216 | Combination Sum III | Java | Medium |
301 | Remove Invalid Parentheses (Classic) | Java | Hard |
401 | Binary Watch | Java | Easy |
437 | Path Sum III | Java | Medium |
842 | Split Array into Fibonacci Sequence | Java | Medium |
# | Title | Solution | Difficulty |
---|---|---|---|
4 | Median of Two Sorted Arrays (Classic) | Java | Hard |
69 | Sqrt(x) | Java | Easy |
493 | Reverse Pairs (Classic) | Java | Hard |
1539 | Kth Missing Positive Number (Classic) | Java | Easy |
Important
# | Title | Solution | Difficulty |
---|---|---|---|
208 | Implement Trie (Prefix Tree) | Java | Medium |
# | Title | Solution | Difficulty |
---|---|---|---|
146 | LRU Cache | Java | Medium |
380 | Insert Delete GetRandom O(1) | Java | Medium |
1244 | Design A Leaderboard | Java | Medium |
1396 | Design Underground System | Java | Medium |