Search a target in a rotated sorted array with no duplicates. Modified binary search identifies which half is sorted, then checks the target range. O(log n) time.
March 19, 2026 Read →
Determine if you can reach the last index. Greedy: track maximum reachable index. If current position exceeds max reach, return false. O(n) O(1).
March 19, 2026 Read →
Rotate array right by k steps. Triple reverse trick: reverse whole, reverse first k, reverse rest. O(n) time O(1) space.
March 19, 2026 Read →
Find the minimum element in a rotated sorted array with no duplicates. Binary search: the minimum is in the unsorted half. O(log n) time O(1) space.
March 19, 2026 Read →
Find k most frequent elements. Approach 1: min-heap O(n log k). Approach 2: bucket sort O(n). Full 5-language solutions.
March 19, 2026 Read →