Choose the data structure from the result you need to maintain, then state its invariant. This set uses new tasks across tries, heaps, intervals, trees, linked lists, and monotonic scans. The business setting changes, but the comparison and boundary rules still decide correctness.
For each problem, describe the approach and expected complexity before coding. Write one test for an empty or minimal input and one for ties, a missing answer, or an endpoint boundary. Then implement the solution in the language you expect to use in an interview. If the first idea sorts everything, consider whether a smaller heap or a direct BST search could reduce the work. The checks accept any correct implementation; explain the cost of the approach you choose.