> For the complete documentation index, see [llms.txt](https://jinjunliu.gitbook.io/notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jinjunliu.gitbook.io/notes/leetcode.md).

# Leetcode

This notebook records the Leetcode problems I have solved.

### Solved Leetcode Problems

In chronological order:

| Date       | Problem                                                                       | type                 |
| ---------- | ----------------------------------------------------------------------------- | -------------------- |
| 5/15/2022  | 3Sum, 3Sum Closest                                                            | array                |
| 5/16/2022  | Longest Substring Without Repeating Characters, Longest Palindromic Substring | string               |
| 5/17/2022  | Container With Most Water, Remove Nth Node From End of List                   | two pointers         |
| 5/18/2022  | Add Two Numbers, Merge Two Sorted Lists                                       | linked list          |
| 5/19/2022  | Valid Parentheses                                                             | stack                |
| 5/20/2022  | Simplify Path                                                                 | stack                |
| 5/21/2022  | Binary Tree Inorder Traversal, Unique Binary Search Trees                     | tree                 |
| 5/27/2022  | Generate Parentheses                                                          | dynamic programming  |
| 7/27/2022  | Letter Combinations of a Phone Number                                         | Backtracking         |
| 7/29/2022  | Combination Sum                                                               | Backtracking         |
| 8/16/2022  | Validate Binary Search Tree                                                   | DFS                  |
| 8/17/2022  | Recover Binary Search Tree                                                    | DFS                  |
| 8/18/2022  | Same Tree, Symmetric Tree                                                     | BFS                  |
| 8/19/2022  | Search in Rotated Sorted Array                                                | Binary Search        |
| 8/20/2022  | Linked List Cycle II                                                          | Linked List          |
| 8/22/2022  | First Bad Version, Sqrt(x), Search Insert Position                            | Binary Search        |
| 8/25/2022  | Capacity to Ship Packages Within D Days                                       | Binary Search        |
| 8/27/2022  | Reverse Integer, Palindrome Number, Two Sum                                   | Math, Hash Table     |
| 9/8/2022   | Group Anagrams, Merge Intervals                                               | Sorting              |
| 9/10/2022  | Add Binary                                                                    | Bit Manipulation     |
| 9/17/2022  | Longest Consecutive Sequence                                                  | Union Find           |
| 01/22/2024 | Merge Strings Alternately, Reverse Words in a String                          | String               |
| 01/23/2024 | Greatest Common Divisor of Strings, Product of Array Except Self              | String, Array        |
| 01/24/2024 | Kids With the Greatest Number of Candies, Increasing Triplet Subsequence      | Array                |
| 08/03/2024 | Reverse Vowels of a String                                                    | Two Pointers         |
| 05/30/2025 | String Compression                                                            | Two Pointers, String |
| 05/30/2025 | Move Zeros                                                                    | Two Pointers, Array  |

In numerical order:

| Number | Title                                                                                                                           | Difficulty |
| ------ | ------------------------------------------------------------------------------------------------------------------------------- | ---------- |
| 1      | [Two Sum](https://leetcode.com/problems/two-sum/)                                                                               | Easy       |
| 2      | [Add Two Numbers](https://leetcode.com/problems/add-two-numbers/)                                                               | Medium     |
| 3      | [Longest Substring Without Repeating Characters](https://leetcode.com/problems/longest-substring-without-repeating-characters/) | Medium     |
| 5      | [Longest Palindromic Substring](https://leetcode.com/problems/longest-palindromic-substring/)                                   | Medium     |
| 7      | [Reverse Integer](https://leetcode.com/problems/reverse-integer/)                                                               | Medium     |
| 9      | [Palindrome Number](https://leetcode.com/problems/palindrome-number/)                                                           | Easy       |
| 11     | [Container With Most Water](https://leetcode.com/problems/container-with-most-water/)                                           | Medium     |
| 15     | [3Sum](https://leetcode.com/problems/3sum/)                                                                                     | Medium     |
| 16     | [3Sum Closest](https://leetcode.com/problems/3sum-closest/)                                                                     | Medium     |
| 17     | [Letter Combinations of a Phone Number](https://leetcode.com/problems/letter-combinations-of-a-phone-number/)                   | Medium     |
| 19     | [Remove Nth Node From End of List](https://leetcode.com/problems/remove-nth-node-from-end-of-list/)                             | Medium     |
| 20     | [Valid Parentheses](https://leetcode.com/problems/valid-parentheses/)                                                           | Easy       |
| 21     | [Merge Two Sorted Lists](https://leetcode.com/problems/merge-two-sorted-lists/)                                                 | Easy       |
| 22     | [Generate Parentheses](https://leetcode.com/problems/generate-parentheses/)                                                     | Medium     |
| 33     | [Search in Rotated Sorted Array](https://leetcode.com/problems/search-in-rotated-sorted-array/)                                 | Medium     |
| 35     | [Search Insert Position](https://leetcode.com/problems/search-insert-position/)                                                 | Easy       |
| 39     | [Combination Sum](https://leetcode.com/problems/combination-sum/)                                                               | Medium     |
| 49     | [Group Anagrams](https://leetcode.com/problems/group-anagrams/)                                                                 | Medium     |
| 56     | [Merge Intervals](https://leetcode.com/problems/merge-intervals/)                                                               | Medium     |
| 67     | [Add Binary](https://leetcode.com/problems/add-binary/)                                                                         | Easy       |
| 69     | [Sqrt(x)](https://leetcode.com/problems/sqrtx/)                                                                                 | Easy       |
| 71     | [Simplify Path](https://leetcode.com/problems/simplify-path/)                                                                   | Medium     |
| 94     | [Binary Tree Inorder Traversal](https://leetcode.com/problems/binary-tree-inorder-traversal/)                                   | Easy       |
| 96     | [Unique Binary Search Trees](https://leetcode.com/problems/unique-binary-search-trees/)                                         | Medium     |
| 98     | [Validate Binary Search Tree](https://leetcode.com/problems/validate-binary-search-tree/)                                       | Medium     |
| 99     | [Recover Binary Search Tree](https://leetcode.com/problems/recover-binary-search-tree/)                                         | Medium     |
| 100    | [Same Tree](https://leetcode.com/problems/same-tree/)                                                                           | Easy       |
| 101    | [Symmetric Tree](https://leetcode.com/problems/symmetric-tree/)                                                                 | Easy       |
| 128    | [Longest Consecutive Sequence](https://leetcode.com/problems/longest-consecutive-sequence/)                                     | Medium     |
| 142    | [Linked List Cycle II](https://leetcode.com/problems/linked-list-cycle-ii/)                                                     | Medium     |
| 151    | [Reverse Words in a String](https://leetcode.com/problems/reverse-words-in-a-string/)                                           | Medium     |
| 238    | [Product of Array Except Self](https://leetcode.com/problems/product-of-array-except-self/)                                     | Medium     |
| 278    | [First Bad Version](https://leetcode.com/problems/first-bad-version/)                                                           | Easy       |
| 283    | [Move Zeros](https://leetcode.com/problems/move-zeroes/)                                                                        | Easy       |
| 334    | [Increasing Triplet Subsequence](https://leetcode.com/problems/increasing-triplet-subsequence/)                                 | Medium     |
| 345    | [Reverse Vowels of a String](https://leetcode.com/problems/reverse-vowels-of-a-string/)                                         | Easy       |
| 443    | [String Compression](https://leetcode.com/problems/string-compression/)                                                         | Medium     |
| 1011   | [Capacity to Ship Packages Within D Days](https://leetcode.com/problems/capacity-to-ship-packages-within-d-days/)               | Medium     |
| 1071   | [Greatest Common Divisor of Strings](https://leetcode.com/problems/greatest-common-divisor-of-strings/)                         | Easy       |
| 1431   | [Kids With the Greatest Number of Candies](https://leetcode.com/problems/kids-with-the-greatest-number-of-candies/)             | Easy       |
| 1768   | [Merge Strings Alternately](https://leetcode.com/problems/merge-strings-alternately/)                                           | Easy       |

### Resources

* <https://books.halfrost.com/leetcode/>
* [Coding Interview Preparation - Kaiyu Zheng](https://github.com/jinjunliu/notes/blob/master/docs/Coding_Interview_Preparation_document.pdf)
