Meeting Rooms II
Updated
Problem 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 Phone Screen questions
- Count Months Starting on SundayPHONE SCREEN · Seen Aug 2026
- Longest Even-Length WordPHONE SCREEN · Seen Aug 2026
- Range ModulePHONE SCREEN · Seen Aug 2026
- Sort Real Number StringsPHONE SCREEN · Seen Jan 2026
- Check a Password Against a Supplied PolicyPHONE SCREEN · Seen Jun 2025
- Convert a Restricted Function to an Arrow FunctionPHONE SCREEN · Seen Jun 2025
- Repair One Missing Function Punctuation CharacterPHONE SCREEN · Seen Jun 2025
- Can the Singer Perform the Song?PHONE SCREEN · Seen Mar 2025
- Rooms With Two Other Entrances and a Treasure SuccessorPHONE SCREEN · Seen Mar 2025
- First Dictionary Word from Note LettersPHONE SCREEN · Seen Aug 2022
Similar questions at other companies
- Meeting Rooms IIUber · PHONE SCREENUber interview questions
- Meeting Rooms IIAmazon · PHONE SCREEN · ONSITE INTERVIEW
- Earliest Common Meeting SlotAdobe · PHONE SCREENAdobe interview questions
- Most Employees Working at OnceCitadel · OACitadel interview questions
- Minimum Machines for TasksExpedia · OAExpedia interview questions
- Intersect Multiple Interval ListsGoogle · ONSITE INTERVIEWGoogle interview questions
- Merge IntervalsApple · OA · PHONE SCREEN · ONSITE INTERVIEWApple interview questions
- Merge Sorted Squares of Two ArraysWhatNot · PHONE SCREEN · ONSITE INTERVIEWWhatNot interview questions
- Merge Overlapping IntervalsAtlassian · PHONE SCREEN · ONSITE INTERVIEWAtlassian interview questions
- Peak Chat Load Across AgentsCresta · PHONE SCREENCresta interview questions