Data Structures & AlgorithmsHardProduct company OA · Amazon/Microsoft-style OA
Meetings (closed-open as half-open intervals) are [1,4), [1,4), [2,6), [5,8), [3,9), [7,10). A room can be reused the moment a meeting ends. What is the minimum number of rooms?
- A. 5
- B. 4
- C. 3
- D. 6
Correct answer: B. 4
A sweep over start and end events, processing ends before starts at equal times, gives the peak number of simultaneous meetings. Two identical meetings both count, so duplicates must not be merged.
More Coding Interview Problems questions
- Closed integer intervals [1,3], [2,5], [4,7], [6,9], [8,10], [5,6] are available. What is the minimum number needed so that every integer…
- Array [3, 1, 2, 5, 0, 4, 2]. How many contiguous subarrays have a sum equal to twice their length?
- Array [1, 3, 5, 4, 2, 6, 8, 7, 9]. What is the length of the shortest contiguous segment that, once sorted, makes the whole array sorted?
- How many permutations of (0, 1, 2, 3) have exactly one position i with p[i] = i?
- Arrays A = [2, 5, 3, 7] and B = [4, 6, 1, 9]. How many pairs (x from A, y from B) satisfy 10 <= x y <= 40?
- Trains arrive at 100, 140, 150, 180, 200 and depart at 120, 160, 190, 210, 230 (times are not paired). A platform holds one train at a…