Below is a list of problems I’ve encountered and solved, organized by their complexity and topic for ease of reference and study.
| # | Level | Topic | Problem Name & Link | Solution Link | Extra Info |
|---|---|---|---|---|---|
| 1 | Medium | Linked List | Add Two Numbers | Solution | <summary>Details</summary>Time Complexity: O(max(m, n)) where m and n represent the lengths of the two non-empty linked lists.Space Complexity: O(max(m, n)) accounting for the new list. |
| 2 | Medium | Arrays | Last Moment Before All Ants Fall Out of a Plank | Solution | <summary>Details</summary>Time Complexity: O(n) - direct traversal.Space Complexity: O(1) - no additional space utilized beyond variables. |
| 3 | Medium | Arrays | Find the Winner of an Array Game | Solution | <summary>Details</summary>Time Complexity: O(n) - a single traversal.Space Complexity: O(1) - in-place with minimal variable usage. |
| 4 | Medium | Arrays | Remove Duplicates from Sorted Array II | Solution | <summary>Details</summary>Time Complexity: Solution 1: O(n log n) - set operations are logarithmic. Solution 2: O(n log n) - due to binary search.Space Complexity: Solution 1: O(n) - set holds unique elements. Solution 2: O(1) - constant space. |
| 5 | Medium | Arrays | Rotate Array | Solution | <summary>Details</summary>Time Complexity: O(n) - leveraging the mod operation for rotation.Space Complexity: O(1) - in-place using C++ algorithms. |
| 6 | Medium | Arrays | Eliminate Maximum Number of Monsters | Solution | <summary>Details</summary>Time Complexity: O(n log n) - sorting time.Space Complexity: O(1) - in-place with transform operations. |
| 7 | Medium | Strings | Count Number of Homogenous Substrings | Solution | <summary>Details</summary>Time Complexity: O(n) - Goes through each character of the string only once.Space Complexity: O(1) - Fixed amount of space for variables and iterators. |
| 8 | Medium | Design | Seat Reservation Manager | Solution | <summary>Details</summary>Time Complexity: O(n log n) for setup, O(log n) for operations - due to priority queue management.Space Complexity: O(n) - storage for seat management. |
| 9 | Medium | Math | Determine if a Cell is Reachable at a Given Time | Solution | <summary>Details</summary>Time Complexity: O(1) - Computation of Chebyshev distance and reachability check.Space Complexity: O(1) - Constant space used for the calculation. |
| 10 | Hard | Arrays | Candy | Solution | <summary>Details</summary>Time Complexity: O(n) - linear passes to distribute candies.Space Complexity: O(n) - auxiliary space for left-to-right and right-to-left scans. |
| 11 | Hard | Arrays | Trapping Rain Water | Solution | <summary>Details</summary>Time Complexity: O(n) - using the two-pointer technique.Space Complexity: O(1) - constant space with pointers. |
| # | Problem | Solution | Difficulty | Tags |
|---|---|---|---|---|
| 1 | Best Time to Buy and Sell Stock II | Solution | Easy | <summary>View Tags</summary>Arrays, Dynamic Programming |
| 2 | Sort Vowels in a String | Solution | Easy | <summary>View Tags</summary>String Manipulation |
| 3 | Best Time to Buy and Sell Stock | Solution | Easy | <summary>View Tags</summary>Arrays, Dynamic Programming |
| 4 | Jump Game II | Solution | Medium | <summary>View Tags</summary>Dynamic Programming, Greedy, Arrays |
| 5 | Jump Game II | Solution | Medium | <summary>View Tags</summary>Dynamic Programming, Greedy, Arrays |
| 6 | Jump Game | Solution | Medium | <summary>View Tags</summary>Dynamic Programming, Greedy, Arrays |
| 7 | LRU Cache | Solution | Hard | <summary>View Tags</summary>Design, Hash Table, Doubly-Linked List |
| 8 | LRU Cache | Solution | Hard | <summary>View Tags</summary>Design, Hash Table, Doubly-Linked List |
| 9 | Bus Routes | Solution | Hard | <summary>View Tags</summary>Graph, Breadth-First Search |
| 10 | Count Nodes Equal to Average of Subtree | Solution | Medium | <summary>View Tags</summary>Tree, Depth-First Search |
| 11 | Unique Length-3 Palindromic Subsequences | Solution | Medium | <summary>View Tags</summary>String, Dynamic Programming |
| 12 | Majority Element | Solution | Easy | <summary>View Tags</summary>Arrays, Divide and Conquer, Bit Manipulation |
| 13 | Majority Element | Solution | Easy | <summary>View Tags</summary>Arrays, Divide and Conquer, Bit Manipulation |
| 14 | Majority Element | Solution | Easy | <summary>View Tags</summary>Arrays, Divide and Conquer, Bit Manipulation |
| 15 | Majority Element | Solution | Easy | <summary>View Tags</summary>Arrays, Divide and Conquer, Bit Manipulation |
| 16 | Valid Palindrome | Solution | Easy | <summary>View Tags</summary>Two Pointers, String |
| 17 | Valid Palindrome | Solution | Easy | <summary>View Tags</summary>Two Pointers, String |
| 18 | Valid Sudoku - Bitmask Approach | Solution | Medium | <summary>View Tags</summary>Hash Table, Matrix |
| 19 | Valid Sudoku - Set-Based Approach | Solution | Medium | <summary>View Tags</summary>Hash Table, Matrix |
| 20 | Remove Duplicates from Sorted Array | Solution | Easy | <summary>View Tags</summary>Two Pointers, Array |
| 21 | Design Graph With Shortest Path Calculator | Solution | Medium | <summary>View Tags</summary>Graph, Design |
| 22 | Remove Element - Two-Pointer Approach | Solution | Easy | <summary>View Tags</summary>Array, Two Pointers |
| 23 | Merge Sorted Array | Solution | Easy | <summary>View Tags</summary>Array, Two Pointers |
| 24 | Merge Sorted Array | Solution | Easy | <summary>View Tags</summary>Array, Two Pointers |
| 25 | Substring with Concatenation of All Words | Solution | Hard | <summary>View Tags</summary>Hash Table, String |
| 26 | Build an Array With Stack Operations | Solution | Easy | <summary>View Tags</summary>Stack, Array, Simulation |
| 27 | Build an Array With Stack Operations | Solution | Easy | <summary>View Tags</summary>Stack, Array, Simulation |
| 28 | Restore the Array From Adjacent Pairs | Solution | Medium | <summary>View Tags</summary>Hash Table, Array |
| 29 | Restore the Array From Adjacent Pairs | Solution | Medium | <summary>View Tags</summary>Hash Table, Array |
| 30 | Count Number of Homogenous Substrings | Solution | Medium | <summary>View Tags</summary>String, Dynamic Programming |
| 31 | Count Number of Homogenous Substrings | Solution | Medium | <summary>View Tags</summary>String, Dynamic Programming |