Data Structures & AlgorithmsHardProduct company OA · Amazon/Microsoft-style OA
Meetings are the half-open intervals [0,30), [5,10), [15,20), [10,15), [20,25); a room can host a new meeting starting exactly when another one ends. What is the minimum number of rooms needed?
- A. 3
- B. 5
- C. 2
- D. 4
Correct answer: C. 2
Sweep over events and process ends before starts at the same time, so a room freed at time 10 is reused at time 10. Processing starts first at a tie claims an extra room; that version gives 3 instead of 2.
More Coding Interview Problems questions
- Balloons are closed horizontal intervals [10,16], [2,8], [1,6], [7,12]. One vertical arrow at x bursts every balloon whose interval…
- Half-open intervals [1,2), [2,3), [3,4) and [1,3) are given. What is the minimum number of intervals that must be removed so that the…
- Jobs are (start, end, profit) triples: (1,4,5), (3,5,1), (0,6,8), (4,7,4), (3,8,6), (5,9,3), (6,10,2), (8,11,4). One machine can run a set…
- Intervals [0,4], [3,7], [6,10], [2,6], [9,12], [1,3] are available. What is the minimum number of them needed to cover the whole segment…
- Problem: A directed road map has junctions 0..4 and roads (u, v, w): (0,1,1), (0,2,1), (1,3,1), (2,3,1), (3,4,1), (1,2,1). Count the…
- Problem: A grid of 0/1 costs (a cell costs its value when you enter it) is solved by 0-1 BFS from the top-left cell to the bottom-right…