Solve classic LeetCode problems
Company: Meta
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Onsite
Overview: This question evaluates proficiency with core data structures and algorithmic techniques including array selection and ordering, string pattern grouping, interval/rectangle merging, and binary search tree range queries.
Constraints
- 1 <= len(nums) <= 200000
- -10^9 <= nums[i] <= 10^9
- 1 <= k <= len(nums)
Hints
- Maintain a min-heap of size k to track the k largest elements.
- Alternatively, use Quickselect (Hoare's selection) to achieve average O(n) time.
- Transform k-th largest to (n - k)-th index in ascending order.