{"id":28334260,"url":"https://github.com/terenceclzhang/leetcode-solutions","last_synced_at":"2025-10-12T09:37:50.522Z","repository":{"id":308694113,"uuid":"982107845","full_name":"TerenceCLZhang/LeetCode-Solutions","owner":"TerenceCLZhang","description":"LeetCode Solutions","archived":false,"fork":false,"pushed_at":"2025-09-24T12:34:30.000Z","size":255,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-24T14:34:08.723Z","etag":null,"topics":["algorithms","data-structures","data-structures-and-algorithms","leetcode","leetcode-solutions"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TerenceCLZhang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-05-12T11:40:39.000Z","updated_at":"2025-09-24T12:34:33.000Z","dependencies_parsed_at":"2025-09-24T14:21:52.186Z","dependency_job_id":null,"html_url":"https://github.com/TerenceCLZhang/LeetCode-Solutions","commit_stats":null,"previous_names":["terenceclzhang/leetcode-solutions"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/TerenceCLZhang/LeetCode-Solutions","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TerenceCLZhang%2FLeetCode-Solutions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TerenceCLZhang%2FLeetCode-Solutions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TerenceCLZhang%2FLeetCode-Solutions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TerenceCLZhang%2FLeetCode-Solutions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TerenceCLZhang","download_url":"https://codeload.github.com/TerenceCLZhang/LeetCode-Solutions/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TerenceCLZhang%2FLeetCode-Solutions/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279010938,"owners_count":26084837,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-12T02:00:06.719Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithms","data-structures","data-structures-and-algorithms","leetcode","leetcode-solutions"],"created_at":"2025-05-26T21:18:20.595Z","updated_at":"2025-10-12T09:37:50.507Z","avatar_url":"https://github.com/TerenceCLZhang.png","language":"Java","readme":"# LeetCode Solutions\n\nThis repository contains my leetcode solutions to select questions.\n\n## Contents\n\n- [Algomap.io](#algomapio)\n  - [Arrays \u0026 Strings](#arrays--strings)\n  - [HashMaps \u0026 Sets](#hashmaps--sets)\n  - [2 Pointers](#2-pointers)\n  - [Stacks](#stacks)\n  - [Linked Lists](#linked-lists)\n  - [Binary Search](#binary-search)\n  - [Sliding Window](#sliding-window)\n  - [Trees](#trees)\n  - [Heaps](#heaps)\n  - [Recursive Backtracking](#recursive-backtracking)\n  - [Graphs](#graphs)\n  - [Dynamic Programming](#dynamic-programming)\n  - [Bit Manipulation](#bit-manipulation)\n    \u003c!-- - [NeetCode 150](#neetcode-150) --\u003e\n    \u003c!-- - [LeetCode 75](#leetcode-75) --\u003e\n    \u003c!-- - [LeetCode Top Interview 150](#leetcode-top-interview-150) --\u003e\n\n## Algomap.io\n\nhttps://algomap.io/list/\n\n### Arrays \u0026 Strings\n\n| Problem                                                                                                                         | Solutions                                                         | Time                  | Space    |\n| ------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- | --------------------- | -------- |\n| [2239. Find Closest Number to Zero](https://leetcode.com/problems/find-closest-number-to-zero/description/)                     | [Link](/2239.%20Find%20Closest%20Number%20to%20Zero/)             | $$O(n)$$              | $$O(1)$$ |\n| [1768. Merge Strings Alternately](https://leetcode.com/problems/merge-strings-alternately/description/)                         | [Link](/1768.%20Merge%20Strings%20Alternately/)                   | $$O(n)$$              | $$O(n)$$ |\n| [13. Roman to Integer](https://leetcode.com/problems/roman-to-integer/description/)                                             | [Link](/13.%20Roman%20to%20Integer/)                              | $$O(n)$$              | $$O(1)$$ |\n| [392. Is Subsequence](https://leetcode.com/problems/is-subsequence/description/)                                                | [Link](/392.%20Is%20Subsequence/)                                 | $$O(n)$$              | $$O(1)$$ |\n| [121. Best Time to Buy and Sell Stock](https://leetcode.com/problems/best-time-to-buy-and-sell-stock/description/)              | [Link](/121.%20Best%20Time%20to%20Buy%20and%20Sell%20Stock/)      | $$O(n)$$              | $$O(1)$$ |\n| [14. Longest Common Prefix](https://leetcode.com/problems/longest-common-prefix/description/)                                   | [Link](/14.%20Longest%20Common%20Prefix/)                         | $$O(n \\cdot m)$$      | $$O(1)$$ |\n| [228. Summary Ranges](https://leetcode.com/problems/summary-ranges/description/)                                                | [Link](/228.%20Summary%20Ranges/)                                 | $$O(n)$$              | $$O(1)$$ |\n| [228. Summary Ranges](https://leetcode.com/problems/summary-ranges/description/)                                                | [Link](/228.%20Summary%20Ranges/)                                 | $$O(n)$$              | $$O(1)$$ |\n| [26. Remove Duplicates from Sorted Array](https://leetcode.com/problems/remove-duplicates-from-sorted-array/description/)       | [Link](/26.%20Remove%20Duplicates%20from%20Sorted%20Array/)       | $$O(n)$$              | $$O(1)$$ |\n| [27. Remove Element](https://leetcode.com/problems/remove-element/description/)                                                 | [Link](/27.%20Remove%20Element/)                                  | $$O(n)$$              | $$O(1)$$ |\n| [88. Merge Sorted Array](https://leetcode.com/problems/merge-sorted-array/description/)                                         | [Link](/88.%20Merge%20Sorted%20Array/)                            | $$O(n + m)$$          | $$O(1)$$ |\n| [122. Best Time to Buy and Sell Stock II](https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii/description/)        | [Link](/122.%20Best%20Time%20to%20Buy%20and%20Sell%20Stock%20II/) | $$O(n)$$              | $$O(1)$$ |\n| [80. Remove Duplicates from Sorted Array II](https://leetcode.com/problems/remove-duplicates-from-sorted-array-ii/description/) | [Link](/80.%20Remove%20Duplicates%20from%20Sorted%20Array%20II/)  | $$O(n)$$              | $$O(1)$$ |\n| [75. Sort Colors (Dutch National Flag Problem)](https://leetcode.com/problems/sort-colors/description/)                         | [Link](/75.%20Sort%20Colors/)                                     | $$O(n)$$              | $$O(1)$$ |\n| [238. Product of Array Except Self](https://leetcode.com/problems/product-of-array-except-self/description/)                    | [Link](/238.%20Product%20of%20Array%20Except%20Self/)             | $$O(n)$$              | $$O(1)$$ |\n| [274. H-Index](https://leetcode.com/problems/h-index/description/)                                                              | [Link](/274.%20H-Index/)                                          | $$O(n)$$              | $$O(n)$$ |\n| [**56. Merge Intervals**](https://leetcode.com/problems/merge-intervals/description/)                                           | [Link](/56.%20Merge%20Intervals/)                                 | $$O(n \\cdot \\log n)$$ | $$O(n)$$ |\n| [**54. Spiral Matrix**](https://leetcode.com/problems/spiral-matrix/description/)                                               | [Link](/54.%20Spiral%20Matrix/)                                   | $$O(m \\cdot n)$$      | $$O(1)$$ |\n| [**6. Zigzag Conversion**](https://leetcode.com/problems/zigzag-conversion/description/)                                        | [Link](/6.%20Zigzag%20Conversion/)                                | $$O(n)$$              | $$O(n)$$ |\n| [**48. Rotate Image**](https://leetcode.com/problems/rotate-image/description/)                                                 | [Link](/48.%20Rotate%20Image/)                                    | $$O(n^2)$$            | $$O(1)$$ |\n\n### Hashmaps \u0026 Sets\n\n| Problem                                                                                                          | Solutions                                          | Time             | Space            |\n| ---------------------------------------------------------------------------------------------------------------- | -------------------------------------------------- | ---------------- | ---------------- |\n| [771. Jewels and Stones](https://leetcode.com/problems/jewels-and-stones/description/)                           | [Link](/771.%20Jewels%20and%20Stones/)             | $$O(n)$$         | $$O(n)$$         |\n| [217. Contains Duplicate](https://leetcode.com/problems/contains-duplicate/description/)                         | [Link](/217.%20Contains%20Duplicate/)              | $$O(n)$$         | $$O(n)$$         |\n| [383. Ransom Note](https://leetcode.com/problems/ransom-note/description/)                                       | [Link](/383.%20Ransom%20Note/)                     | $$O(n + m)$$     | $$O(m)$$         |\n| [242. Valid Anagram](https://leetcode.com/problems/valid-anagram/description/)                                   | [Link](/242.%20Valid%20Anagram/)                   | $$O(n)$$         | $$O(1)$$         |\n| [1189. Maximum Number of Balloons](https://leetcode.com/problems/maximum-number-of-balloons/description/)        | [Link](/1189.%20Maximum%20Number%20of%20Balloons/) | $$O(n)$$         | $$O(1)$$         |\n| [1. Two Sum](https://leetcode.com/problems/two-sum/description/)                                                 | [Link](/1.%20Two%20Sum/)                           | $$O(n)$$         | $$O(n)$$         |\n| [36. Valid Sudoku](https://leetcode.com/problems/valid-sudoku/description/)                                      | [Link](/36.%20Valid%20Sudoku/)                     | $$O(1)$$         | $$O(1)$$         |\n| [49. Group Anagrams](https://leetcode.com/problems/group-anagrams/description/)                                  | [Link](/49.%20Group%20Anagrams/)                   | $$O(n \\cdot m)$$ | $$O(n \\cdot m)$$ |\n| [169. Majority Element](https://leetcode.com/problems/majority-element/description/)                             | [Link](/169.%20Majority%20Element/)                | $$O(n)$$         | $$O(1)$$         |\n| [**128. Longest Consecutive Sequence**](https://leetcode.com/problems/longest-consecutive-sequence/description/) | [Link](/128.%20Longest%20Consecutive%20Sequence/)  | $$O(n)$$         | $$O(n)$$         |\n\n### 2 Pointers\n\n| Problem                                                                                                                | Solutions                                                         | Time       | Space    |\n| ---------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- | ---------- | -------- |\n| [977. Squares of a Sorted Array](https://leetcode.com/problems/squares-of-a-sorted-array/description/)                 | [Link](/977.%20Squares%20of%20a%20Sorted%20Array/)                | $$O(n)$$   | $$O(n)$$ |\n| [344. Reverse String](https://leetcode.com/problems/reverse-string/description/)                                       | [Link](/344.%20Reverse%20String/)                                 | $$O(n)$$   | $$O(1)$$ |\n| [167. Two Sum II - Input Array Is Sorted](https://leetcode.com/problems/two-sum-ii-input-array-is-sorted/description/) | [Link](/167.%20Two%20Sum%20II%20-%20Input%20Array%20Is%20Sorted/) | $$O(n)$$   | $$O(1)$$ |\n| [125. Valid Palindrome](https://leetcode.com/problems/valid-palindrome/description/)                                   | [Link](/125.%20Valid%20Palindrome/)                               | $$O(n)$$   | $$O(1)$$ |\n| [15. 3Sum](https://leetcode.com/problems/3sum/description/)                                                            | [Link](/15.%203Sum/)                                              | $$O(n^2)$$ | $$O(1)$$ |\n| [11. Container With Most Water](https://leetcode.com/problems/container-with-most-water/description/)                  | [Link](/11.%20Container%20With%20Most%20Water/)                   | $$O(n)$$   | $$O(1)$$ |\n| [**16. 3Sum Closest**](https://leetcode.com/problems/3sum-closest/description/)                                        | [Link](/16.%203Sum%20Closest/)                                    | $$O(n^2)$$ | $$O(1)$$ |\n| [**18. 4Sum**](https://leetcode.com/problems/4sum/description/)                                                        | [Link](/18.%204Sum/)                                              | $$O(n^3)$$ | $$O(1)$$ |\n\n### Stacks\n\n| Problem                                                                                                              | Solutions                                               | Time     | Space    |\n| -------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------- | -------- | -------- |\n| [682. Baseball Game](https://leetcode.com/problems/baseball-game/description/)                                       | [Link](/682.%20Baseball%20Game/)                        | $$O(n)$$ | $$O(n)$$ |\n| [20. Valid Parentheses](https://leetcode.com/problems/valid-parentheses/description/)                                | [Link](/20.%20Valid%20Parentheses/)                     | $$O(n)$$ | $$O(n)$$ |\n| [150. Evaluate Reverse Polish Notation](https://leetcode.com/problems/evaluate-reverse-polish-notation/description/) | [Link](/150.%20Evaluate%20Reverse%20Polish%20Notation/) | $$O(n)$$ | $$O(n)$$ |\n| [739. Daily Temperatures](https://leetcode.com/problems/daily-temperatures/description/)                             | [Link](/739.%20Daily%20Temperatures/)                   | $$O(n)$$ | $$O(n)$$ |\n| [155. Min Stack](https://leetcode.com/problems/min-stack/description/)                                               | [Link](/155.%20Min%20Stack/)                            | $$O(1)$$ | $$O(n)$$ |\n\n### Linked Lists\n\n| Problem                                                                                                                                           | Solutions                                                                    | Time         | Space    |\n| ------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ------------ | -------- |\n| [83. Remove Duplicates from Sorted List](https://leetcode.com/problems/remove-duplicates-from-sorted-list/description/)                           | [Link](/83.%20Remove%20Duplicates%20from%20Sorted%20List/)                   | $$O(n)$$     | $$O(1)$$ |\n| [2807. Insert Greatest Common Divisors in Linked List](https://leetcode.com/problems/insert-greatest-common-divisors-in-linked-list/description/) | [Link](/2807.%20Insert%20Greatest%20Common%20Divisors%20in%20Linked%20List/) | $$O(n)$$     | $$O(1)$$ |\n| [206. Reverse Linked List](https://leetcode.com/problems/reverse-linked-list/description/)                                                        | [Link](/206.%20Reverse%20Linked%20List/)                                     | $$O(n)$$     | $$O(1)$$ |\n| [21. Merge Two Sorted Lists](https://leetcode.com/problems/merge-two-sorted-lists/description/)                                                   | [Link](/21.%20Merge%20Two%20Sorted%20Lists/)                                 | $$O(n + m)$$ | $$O(1)$$ |\n| [141. Linked List Cycle](https://leetcode.com/problems/linked-list-cycle/description/)                                                            | [Link](/141.%20Linked%20List%20Cycle/)                                       | $$O(n)$$     | $$O(1)$$ |\n| [876. Middle of the Linked List](https://leetcode.com/problems/middle-of-the-linked-list/description/)                                            | [Link](/876.%20Middle%20of%20the%20Linked%20List/)                           | $$O(n)$$     | $$O(1)$$ |\n| [19. Remove Nth Node From End of List](https://leetcode.com/problems/remove-nth-node-from-end-of-list/description/)                               | [Link](/19.%20Remove%20Nth%20Node%20From%20End%20of%20List/)                 | $$O(n)$$     | $$O(1)$$ |\n| [138. Copy List with Random Pointer](https://leetcode.com/problems/copy-list-with-random-pointer/description/)                                    | [Link](/138.%20Copy%20List%20with%20Random%20Pointer/)                       | $$O(n)$$     | $$O(n)$$ |\n\n### Binary Search\n\n| Problem                                                                                                              | Solutions                                                       | Time                    | Space    |\n| -------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------- | ----------------------- | -------- |\n| [704. Binary Search](https://leetcode.com/problems/binary-search/description/)                                       | [Link](/704.%20Binary%20Search/)                                | $$O(\\log n)$$           | $$O(1)$$ |\n| [35. Search Insert Position](https://leetcode.com/problems/search-insert-position/description/)                      | [Link](/35.%20Search%20Insert%20Position/)                      | $$O(\\log n)$$           | $$O(1)$$ |\n| [278. First Bad Version](https://leetcode.com/problems/first-bad-version/description/)                               | [Link](/278.%20First%20Bad%20Version/)                          | $$O(\\log n)$$           | $$O(1)$$ |\n| [367. Valid Perfect Square](https://leetcode.com/problems/valid-perfect-square/description/)                         | [Link](/367.%20Valid%20Perfect%20Square/)                       | $$O(\\log n)$$           | $$O(1)$$ |\n| [74. Search a 2D Matrix](https://leetcode.com/problems/search-a-2d-matrix/description/)                              | [Link](/367.%20Valid%20Perfect%20Square/)                       | $$O(\\log (m \\cdot n))$$ | $$O(1)$$ |\n| [**153. Find Minimum in Rotated Sorted Array**](https://leetcode.com/problems/find-minimum-in-rotated-sorted-array/) | [Link](/153.%20Find%20Minimum%20in%20Rotated%20Sorted%20Array/) | $$O(\\log n)$$           | $$O(1)$$ |\n| [**33. Search in Rotated Sorted Array**](https://leetcode.com/problems/search-in-rotated-sorted-array/description/)  | [Link](/33.%20Search%20in%20Rotated%20Sorted%20Array/)          | $$O(\\log n)$$           | $$O(1)$$ |\n| [**875. Koko Eating Bananas**](https://leetcode.com/problems/koko-eating-bananas/description/)                       | [Link](/875.%20Koko%20Eating%20Bananas/)                        | $$O(n \\cdot \\log m)$$   | $$O(1)$$ |\n\n### Sliding Window\n\n| Problem                                                                                                                                | Solutions                                                             | Time     | Space    |\n| -------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- | -------- | -------- |\n| [643. Maximum Average Subarray I](https://leetcode.com/problems/maximum-average-subarray-i/description/)                               | [Link](/643.%20Maximum%20Average%20Subarray%20I/)                     | $$O(n)$$ | $$O(1)$$ |\n| [1004. Max Consecutive Ones III](https://leetcode.com/problems/max-consecutive-ones-iii/description/)                                  | [Link](/1004.%20Max%20Consecutive%20Ones%20III/)                      | $$O(n)$$ | $$O(1)$$ |\n| [3. Longest Substring Without Repeating Characters](https://leetcode.com/problems/longest-substring-without-repeating-characters/)     | [Link](/3.%20Longest%20Substring%20Without%20Repeating%20Characters/) | $$O(n)$$ | $$O(1)$$ |\n| [**424. Longest Repeating Character Replacement**](https://leetcode.com/problems/longest-repeating-character-replacement/description/) | [Link](/424.%20Longest%20Repeating%20Character%20Replacement/)        | $$O(n)$$ | $$O(1)$$ |\n| [**209. Minimum Size Subarray Sum**](https://leetcode.com/problems/minimum-size-subarray-sum/description/)                             | [Link](/209.%20Minimum%20Size%20Subarray%20Sum/)                      | $$O(n)$$ | $$O(1)$$ |\n| [567. Permutation in String](https://leetcode.com/problems/permutation-in-string/description/)                                         | [Link](/567.%20Permutation%20in%20String/)                            | $$O(n)$$ | $$O(1)$$ |\n\n### Trees\n\n| Problem                                                                                                                                              | Solutions                                                                     | Time             | Space    |\n| ---------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ---------------- | -------- |\n| [226. Invert Binary Tree](https://leetcode.com/problems/invert-binary-tree/description/)                                                             | [Link](/226.%20Invert%20Binary%20Tree/)                                       | $$O(n)$$         | $$O(h)$$ |\n| [104. Maximum Depth of Binary Tree](https://leetcode.com/problems/maximum-depth-of-binary-tree/description/)                                         | [Link](/104.%20Maximum%20Depth%20of%20Binary%20Tree/)                         | $$O(n)$$         | $$O(h)$$ |\n| [**110. Balanced Binary Tree**](https://leetcode.com/problems/balanced-binary-tree/description/)                                                     | [Link](/110.%20Balanced%20Binary%20Tree/)                                     | $$O(n)$$         | $$O(h)$$ |\n| [**543. Diameter of Binary Tree**](https://leetcode.com/problems/diameter-of-binary-tree/description/)                                               | [Link](/543.%20Diameter%20of%20Binary%20Tree//)                               | $$O(n)$$         | $$O(h)$$ |\n| [100. Same Tree](https://leetcode.com/problems/same-tree/description/)                                                                               | [Link](/100.%20Same%20Tree/)                                                  | $$O(n)$$         | $$O(h)$$ |\n| [101. Symmetric Tree](https://leetcode.com/problems/symmetric-tree/description/)                                                                     | [Link](/101.%20Symmetric%20Tree/)                                             | $$O(n)$$         | $$O(h)$$ |\n| [112. Path Sum](https://leetcode.com/problems/path-sum/description/)                                                                                 | [Link](/112.%20Path%20Sum/)                                                   | $$O(n)$$         | $$O(h)$$ |\n| [572. Subtree of Another Tree](https://leetcode.com/problems/subtree-of-another-tree/description/)                                                   | [Link](/572.%20Subtree%20of%20Another%20Tree/)                                | $$O(n \\cdot m)$$ | $$O(h)$$ |\n| [102. Binary Tree Level Order Traversal (BFS)](https://leetcode.com/problems/binary-tree-level-order-traversal/description/)                         | [Link](/102.%20Binary%20Tree%20Level%20Order%20Traversal/)                    | $$O(n)$$         | $$O(n)$$ |\n| [637. Average of Levels in Binary Tree](https://leetcode.com/problems/average-of-levels-in-binary-tree/description/)                                 | [Link](/637.%20Average%20of%20Levels%20in%20Binary%20Tree/)                   | $$O(n)$$         | $$O(n)$$ |\n| [230. Kth Smallest Element in a BST](https://leetcode.com/problems/kth-smallest-element-in-a-bst/description/)                                       | [Link](/230.%20Kth%20Smallest%20Element%20in%20a%20BST/)                      | $$O(n)$$         | $$O(h)$$ |\n| [**530. Minimum Absolute Difference in BST**](https://leetcode.com/problems/minimum-absolute-difference-in-bst/description/)                         | [Link](/530.%20Minimum%20Absolute%20Difference%20in%20BST/)                   | $$O(n)$$         | $$O(n)$$ |\n| [**98. Validate Binary Search Tree**](https://leetcode.com/problems/validate-binary-search-tree/description/)                                        | [Link](/98.%20Validate%20Binary%20Search%20Tree/)                             | $$O(n)$$         | $$O(n)$$ |\n| [**235. Lowest Common Ancestor of a Binary Search Tree**](https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-search-tree/description/) | [Link](/235.%20Lowest%20Common%20Ancestor%20of%20a%20Binary%20Search%20Tree/) | $$O(\\log n)$$    | $$O(1)$$ |\n| [**208. Implement Trie (Prefix Tree)**](https://leetcode.com/problems/implement-trie-prefix-tree/description/)                                       | [Link](/235.%20Lowest%20Common%20Ancestor%20of%20a%20Binary%20Search%20Tree/) | $$O(m)$$         | $$O(n)$$ |\n\n### Heaps\n\n_Note: No JavaScript_\n\n| Problem                                                                                                  | Solutions                                                  | Time                  | Space    |\n| -------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------- | --------------------- | -------- |\n| [1046. Last Stone Weight](https://leetcode.com/problems/last-stone-weight/)                              | [Link](/1046.%20Last%20Stone%20Weight/)                    | $$O(n \\cdot \\log n)$$ | $$O(n)$$ |\n| [215. Kth Largest Element in an Array](https://leetcode.com/problems/kth-largest-element-in-an-array/)   | [Link](/215.%20Kth%20Largest%20Element%20in%20an%20Array/) | $$O(n \\cdot \\log k)$$ | $$O(k)$$ |\n| [347. Top K Frequent Elements](https://leetcode.com/problems/top-k-frequent-elements/description/)       | [Link](/347.%20Top%20K%20Frequent%20Elements/)             | $$O(n \\cdot \\log k)$$ | $$O(k)$$ |\n| [973. K Closest Points to Origin](https://leetcode.com/problems/k-closest-points-to-origin/description/) | [Link](/973.%20K%20Closest%20Points%20to%20Origin/)        | $$O(n \\cdot \\log k)$$ | $$O(k)$$ |\n\n### Recursive Backtracking\n\n| Problem                                                                                                                       | Solutions                                                       | Time                       | Space                  |\n| ----------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------- | -------------------------- | ---------------------- |\n| [78. Subsets](https://leetcode.com/problems/subsets/description/)                                                             | [Link](/78.%20Subsets/)                                         | $$O(2^n \\cdot n)$$         | $$O(2^n \\cdot n)$$     |\n| [46. Permutations](https://leetcode.com/problems/permutations/description/)                                                   | [Link](/46.%20Permutations/)                                    | $$O(n \\cdot n!)$$          | $$O(n  \\cdot n!)$$     |\n| [77. Combinations](https://leetcode.com/problems/combinations/description/)                                                   | [Link](/77.%20Combinations/)                                    | $$O(C(n, k) \\cdot k)$$     | $$O(C(n, k) \\cdot k)$$ |\n| [39. Combination Sum](https://leetcode.com/problems/combination-sum/description/)                                             | [Link](/39.%20Combination%20Sum/)                               | $$O(2^{\\frac{t}{m} + 1})$$ | $$O(\\frac{t}{m})$$     |\n| [17. Letter Combinations of a Phone Number](https://leetcode.com/problems/letter-combinations-of-a-phone-number/description/) | [Link](/17.%20Letter%20Combinations%20of%20a%20Phone%20Number/) | $$O(n \\cdot 4^n)$$         | $$O(n)$$               |\n| [**22. Generate Parentheses**](https://leetcode.com/problems/generate-parentheses/description/)                               | [Link](/22.%20Generate%20Parentheses/)                          | $$O(2^n)$$                 | $$O(n)$$               |\n| [**45. Jump Game II**](https://leetcode.com/problems/jump-game-ii/description/)                                               | [Link](/45.%20Jump%20Game%20II/)                                | $$O(n)$$                   | $$O(1)$$               |\n| [**79. Word Search**](https://leetcode.com/problems/word-search/)                                                             | [Link](/79.%20Word%20Search/)                                   | $$O(m \\cdot n \\cdot 3^w)$$ | $$O(w)$$               |\n\n### Graphs\n\n| Problem                                                                                                       | Solutions                                                | Time            | Space           |\n| ------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------- | --------------- | --------------- |\n| [1971. Find if Path Exists in Graph](https://leetcode.com/problems/find-if-path-exists-in-graph/)             | [Link](/1971.%20Find%20if%20Path%20Exists%20in%20Graph/) | $$O(V + E)$$    | $$O(V + E)$$    |\n| [**200. Number of Islands**](https://leetcode.com/problems/number-of-islands/description/)                    | [Link](/200.%20Number%20of%20Islands/)                   | $$O(m\\cdot n)$$ | $$O(m\\cdot n)$$ |\n| [695. Max Area of Island](https://leetcode.com/problems/max-area-of-island/description/)                      | [Link](/695.%20Max%20Area%20of%20Island/)                | $$O(m\\cdot n)$$ | $$O(m\\cdot n)$$ |\n| [207. Course Schedule (Detect Cycles in a Graph)](https://leetcode.com/problems/course-schedule/description/) | [Link](/207.%20Course%20Schedule/)                       | $$O(V + E)$$    | $$O(V + E)$$    |\n\n### Dynamic Programming\n\n### Bit Manipulation\n\n\u003c!-- ## NeetCode 150\n\n## LeetCode 75\n\n## LeetCode Top Interview 150 --\u003e\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fterenceclzhang%2Fleetcode-solutions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fterenceclzhang%2Fleetcode-solutions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fterenceclzhang%2Fleetcode-solutions/lists"}