Leetcode, Hackerrank, Java 8+, Kotlin, JS practice
No. | name | solution | remark | comments |
---|---|---|---|---|
94 | Binary Tree Inorder Traversal | Java | DFS inorder | |
102 | Binary Tree Level Order Traversal | Java | BFS foundation! | |
144 | Binary Tree Preorder Traversal | Java | DFS preorder | |
145 | Binary Tree Postorder Traversal | Java | DFS postorder |
No. | name | solution | remark | comments |
---|---|---|---|---|
100 | Same Tree | Java, Kotlin | ||
101 | Symmetric Tree | Java, Javascript | ||
226 | Invert Binary Tree | Java, Javascript | ||
257 | Binary Tree Paths | Java | ||
112 | Path Sum | Java, Javascript | ||
113 | Path Sum II | Java, Javascript | backtracking | |
129 | Sum Root to Leaf Numbers | Java, Javascript | ||
111 | Minimum Depth of Binary Tree | Java | ** | ref 104,111 |
104 | Maximum Depth of Binary Tree | Java | ** | ref 104,111 |
No. | name | solution | remark | comments |
---|---|---|---|---|
199 | Binary Tree Right Side View | Java | ||
515 | Find Largest Value in Each Tree Row | Java |
No. | name | solution | remark | comments |
---|---|---|---|---|
L(https://leetcode.com/problems/validate-binary-search-tree/) | Java |
No. | name | solution | remark | comments |
---|---|---|---|---|
437 | Path Sum III | Java |
No. | name | solution | remark | comments |
---|---|---|---|---|
200 | Number of Islands | Java | ||
286 | Walls and Gates | Java | ||
130 | Surrounded Regions | Java | ||
339 | Nested List Weight Sum | Java | ||
364 | Nested List Weight Sum II | Java | ||
127 | Word Ladder | Java | ||
433 | Minimum Genetic Mutation | Java | ||
317 | Shortest Distance from All Buildings | Java | ||
542 | 01 Matrix | Java |
No. | name | solution | remark | comments |
---|---|---|---|---|
136 | Single Number | Java, Kotlin | y | |
191 | Number of 1 Bits | Java, Kotlin | ||
231 | Power of Two | Java, Kotlin | ||
389 | Find the Difference | Java, Kotlin | ||
268 | Missing Number | Java, Kotlin | ||
318 | Maximum Product of Word Lengths | Java, Kotlin | ||
190 | Reverse Bits | Java, Kotlin |
No. | name | solution | remark | comments |
---|---|---|---|---|
252 | Meeting Rooms | Java, Kotlin | intervals | |
253 | Meeting Rooms II | Java, Kotlin | intervals | |
57 | Insert Interval | Java, Kotlin | intervals | |
56 | Merge Intervals | Java, Kotlin | intervals | |
435 | Non-overlapping Intervals | Java | ** | intervals |
436 | Find Right Interval | Java | ** | intervals, treeMap |
729 | My Calendar I | Java | ** | intervals, treeMap |
No. | name | solution | remark | comments |
---|---|---|---|---|
27 | Remove Element | Java, Kotlin, Javascript | ||
26 | Remove Duplicates from Sorted Array | Java, Kotlin, Javascript | ||
80 | Remove Duplicates from Sorted Array II | Java, Kotlin, Javascript | ||
487 | Max Consecutive Ones II | Java, Kotlin, Javascript | ||
487 follow up | Max Consecutive Ones II follow up | Java |
No. | name | solution | remark | comments |
---|---|---|---|---|
11 | Container With Most Water | Java, Kotlin, Javascript | two way, two pointers | |
42 | Trapping Rain Water | Java | * | two pointer |
No. | name | solution | remark | comments |
---|---|---|---|---|
209 | Minimum Size Subarray Sum | Java, Kotlin | one way, two pointers , sliding window | |
238 | ProductOfArrayExceptSelf | Java, Kotlin, Javascript | ||
53 | Maximum Subarray | Java | DP | |
325 | Maximum Size Subarray Sum Equals k | Java | presum, hashMap, like 2-sum | |
152 | Maximum Product Subarray | Java | max, min | |
523 | Continuous Subarray Sum | Java | hashMap, ai+1 +...+ an = | |
548 | Split Array with Equal Sum | Java | ** | tricky one, hard, hashSet |
560 | Subarray Sum Equals K | Java | ** | presum, hashMap, like 2-sum |
No. | name | solution | remark | comments |
---|---|---|---|---|
48 | Rotate Image | Java | 2D Array | |
54 | Spiral Matrix | Java | 2D Array |
No. | name | solution | remark | comments |
---|---|---|---|---|
189 | Rotate Array | Java | reverse all, partial pre k revese, partial post k reverse | |
280 | Wiggle Sort | Java, Kotlin | odd high, even low, not fit, do swap |
No. | name | solution | remark | comments |
---|---|---|---|---|
243 | Shortest Word Distance | Java, Kotlin | ||
245 | Shortest Word Distance III | Java | ||
277 | Find the Celebrity | Java | ||
169 | Majority Element | Java | moore voting algo | |
442 | Find All Duplicates in an Array Element | Java | index idea | |
485 | Max Consecutive Ones | Java | too easy! | |
229 | Majority Element II | Java | * | tricky... |
No. | name | solution | remark | comments |
---|---|---|---|---|
217 | Contains Duplicate | Java | easy one, hashset, or sort | |
575 | Distribute Candies | Java |
No. | name | solution | remark | comments |
---|---|---|---|---|
525 | Contiguous Array | Java | ** | 0, 1 (-1, 1), hashMap (presum, idx) |
447 | Number of Boomerangs | Java | ** | hashMap (dist, poniter's count) |
532 | K-diff Pairs in an Array | Java | * | hashMap (num value, num's count), notice k = 0 case, |
554 | Brick Wall | Java | * | hashMap (presum, presum's count), wall.size - max presum's count |
599 | Minimum Index Sum of Two Lists | Java | * | hashMap (string, index) |
No. | name | solution | remark | comments |
---|---|---|---|---|
12 | Integer to Roman | Java |
No. | name | solution | remark | comments |
---|---|---|---|---|
244 | Shortest Word Distance II | Java | ||
1160 | Find Words That Can Be Formed by Characters | Java |
No. | name | solution | remark | comments |
---|---|---|---|---|
187 | Repeated DNA Sequences | Java, Kotlin |
No. | name | solution | remark | comments |
---|---|---|---|---|
13 | Roman to Integer | Java | ||
696 | Count Binary Substrings | Java |
No. | name | solution | remark | comments |
---|---|---|---|---|
261 | Graph Valid Tree | Java | ||
323 | Number of Connected Components in an Undirected Graph | Java | ||
547 | Number of Provinces | Java |
No. | name | solution | remark | comments |
---|---|---|---|---|
528 | Random Pick with Weight | Java, Javascript |
No. | name | solution | remark | comments |
---|---|---|---|---|
207 | Course Schedule | Java | ||
210 | Course Schedule II | Java |
No. | name | solution | remark | comments |
---|---|---|---|---|
1102 | Path With Maximum Minimum Value | Java | ||
1631 | Path With Minimum Effort | Java |
No. | name | solution | remark | comments |
---|---|---|---|---|
70 | Climbing Stairs | Java |