Problem · Array
Meeting Rooms II
Learn this problemProblem statement
You are given an array of meeting intervals intervals, where each interval is [start, end). Return the minimum number of rooms required to schedule every meeting without overlap.
Intervals are half-open: when one meeting ends at the exact time another begins, they do not overlap and may use the same room. Return 0 when intervals is empty.
Function
minMeetingRooms(intervals: int[][]) → intExamples
Example 1
intervals = [[0,30],[5,10],[15,20]]return = 2The meeting from 0 to 30 overlaps both shorter meetings, while those two shorter meetings can share a second room.
Example 2
intervals = [[0,8],[8,10],[10,15]]return = 1Each meeting starts exactly when the previous meeting ends, so one room can be reused.
Example 3
intervals = []return = 0No meetings require no rooms.
Constraints
0 <= intervals.length <= 100000intervals[i].length == 2-2147483648 <= intervals[i][0] < intervals[i][1] <= 2147483647- Meetings use half-open intervals, so an end time equal to another start time is not an overlap.
More Walmart problems
- Course Schedule IIONSITE INTERVIEW · Seen Jul 2026
- Minimum Stress PathOA · Seen Jul 2026
- K-Capable Model CostsOA · Seen Jun 2026
- K-Capable Model SelectionOA · Seen Jun 2026
- Sort Real Number StringsPHONE SCREEN · Seen Jan 2026
- Minimum Moves to Equal Candy BarsOA · Seen Oct 2024
- Find Length of Longest Good SubsequenceOA · Seen Feb 2024
- Minimum Possible Value of FunctionOA · Seen Feb 2024