~/lc-grind
#380 - Insert Delete GetRandom O(1)
Sep 16, 2025Design a data structure that supports O(1) average time complexity for insert, remove, and retrieving a random element with equal probability, using a combination of a hash map and a dynamic array.
#274 - H-Index
Sep 15, 2025Maximize your academic impact by calculating the h-index, the largest number `h` where at least `h` papers have at least `h` citations each.
#45 - Jump Game II
Sep 12, 2025Master the greedy BFS technique to find the minimum jumps needed to traverse an array where each element dictates your maximum jump length.
#122 - Best Time to Buy and Sell Stock II
Sep 11, 2025Maximize your profit by buying and selling stocks multiple times, capturing every possible price increase in the array with a simple greedy approach.
#189 - Rotate Array
Sep 10, 2025Master the art of rotating an array to the right by k steps in-place with a clever three-reversal technique, a classic problem that elegantly combines array manipulation and two-pointer skills.
#169 - Majority Element
Sep 9, 2025Efficiently find the element that appears more than ⌊n/2⌋ times in an array using sorting, hashing, or the optimal Boyer-Moore Voting Algorithm.
#80 - Remove Duplicates from Sorted Array II
Sep 8, 2025Master the two-pointer technique to efficiently remove duplicates in-place, allowing each element to appear at most twice while preserving the sorted order.
#26 - Remove Duplicates from Sorted Array
Sep 5, 2025Use two pointers to efficiently remove duplicates in-place from a sorted array, returning the count of unique elements while preserving their original order.
#27 - Remove Element
Sep 4, 2025Efficiently remove all instances of a given value from an array in-place using a two-pointer technique, returning the count of remaining elements.
#88 - Merge Sorted Array
Sep 3, 2025Efficiently merge two sorted arrays into `nums1` in-place using a clever two-pointer technique that starts from the end to avoid overwriting.