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 | DetailsTime 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 | DetailsTime 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 | DetailsTime 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 | DetailsTime 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 | DetailsTime 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 | DetailsTime 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 | DetailsTime 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 | DetailsTime 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 | DetailsTime 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 | DetailsTime 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 | DetailsTime Complexity:O(n) - using the two-pointer technique.Space Complexity: O(1) - constant space with pointers. |
Part 2 - downloaded via LeetCode Downloader!
# | Problem | Solution | Difficulty | Tags |
---|---|---|---|---|
1 | Best Time to Buy and Sell Stock II | Solution | Easy | View TagsArrays, Dynamic Programming |
2 | Sort Vowels in a String | Solution | Easy | View TagsString Manipulation |
3 | Best Time to Buy and Sell Stock | Solution | Easy | View TagsArrays, Dynamic Programming |
4 | Jump Game II | Solution | Medium | View TagsDynamic Programming, Greedy, Arrays |
5 | Jump Game II | Solution | Medium | View TagsDynamic Programming, Greedy, Arrays |
6 | Jump Game | Solution | Medium | View TagsDynamic Programming, Greedy, Arrays |
7 | LRU Cache | Solution | Hard | View TagsDesign, Hash Table, Doubly-Linked List |
8 | LRU Cache | Solution | Hard | View TagsDesign, Hash Table, Doubly-Linked List |
9 | Bus Routes | Solution | Hard | View TagsGraph, Breadth-First Search |
10 | Count Nodes Equal to Average of Subtree | Solution | Medium | View TagsTree, Depth-First Search |
11 | Unique Length-3 Palindromic Subsequences | Solution | Medium | View TagsString, Dynamic Programming |
12 | Majority Element | Solution | Easy | View TagsArrays, Divide and Conquer, Bit Manipulation |
13 | Majority Element | Solution | Easy | View TagsArrays, Divide and Conquer, Bit Manipulation |
14 | Majority Element | Solution | Easy | View TagsArrays, Divide and Conquer, Bit Manipulation |
15 | Majority Element | Solution | Easy | View TagsArrays, Divide and Conquer, Bit Manipulation |
16 | Valid Palindrome | Solution | Easy | View TagsTwo Pointers, String |
17 | Valid Palindrome | Solution | Easy | View TagsTwo Pointers, String |
18 | Valid Sudoku - Bitmask Approach | Solution | Medium | View TagsHash Table, Matrix |
19 | Valid Sudoku - Set-Based Approach | Solution | Medium | View TagsHash Table, Matrix |
20 | Remove Duplicates from Sorted Array | Solution | Easy | View TagsTwo Pointers, Array |
21 | Design Graph With Shortest Path Calculator | Solution | Medium | View TagsGraph, Design |
22 | Remove Element - Two-Pointer Approach | Solution | Easy | View TagsArray, Two Pointers |
23 | Merge Sorted Array | Solution | Easy | View TagsArray, Two Pointers |
24 | Merge Sorted Array | Solution | Easy | View TagsArray, Two Pointers |
25 | Substring with Concatenation of All Words | Solution | Hard | View TagsHash Table, String |
26 | Build an Array With Stack Operations | Solution | Easy | View TagsStack, Array, Simulation |
27 | Build an Array With Stack Operations | Solution | Easy | View TagsStack, Array, Simulation |
28 | Restore the Array From Adjacent Pairs | Solution | Medium | View TagsHash Table, Array |
29 | Restore the Array From Adjacent Pairs | Solution | Medium | View TagsHash Table, Array |
30 | Count Number of Homogenous Substrings | Solution | Medium | View TagsString, Dynamic Programming |
31 | Count Number of Homogenous Substrings | Solution | Medium | View TagsString, Dynamic Programming |