Fewest Rooms for All Meetings
Updated
Problem statement
You are given a list of meetings, where meetings[i] = [start, end]. A meeting uses its room from time start up to, but not including, time end, so a meeting that ends at time t frees its room for a meeting that starts at time t.
Two meetings that run at the same moment need different rooms. Return the fewest rooms needed to hold all the meetings. The meetings are given in no particular order.
Function
fewestRooms(meetings: int[][]) → intExamples
Example 1
meetings = [[9,12],[1,5],[4,10],[11,13]]return = 2The meetings overlap two at a time and never three: [1,5] with [4,10] during 4 to 5, [4,10] with [9,12] during 9 to 10, and [9,12] with [11,13] during 11 to 12. Two rooms are enough, and two are needed.
Example 2
meetings = [[0,10],[10,20],[20,30]]return = 1Each meeting ends exactly when the next one starts. A meeting that ends at 10 frees its room for a meeting that starts at 10, so one room is enough.
Example 3
meetings = [[1,100],[10,20],[30,40],[15,35]]return = 3From 15 to 20, the meetings [1,100], [10,20] and [15,35] all run at once, so at least 3 rooms are needed. No moment has four meetings, so the answer is 3.
Constraints
1 <= meetings.length <= 5000meetings[i].length == 20 <= start < end <= 10^9for every meeting[start, end]
More Adobe Phone Screen questions
- Evaluate a Parenthesized Integer ExpressionPHONE SCREEN · Seen Oct 2026
- All Elements of Two BSTs in OrderPHONE SCREEN · Seen Aug 2026
- Rotate an Array In PlaceOA · PHONE SCREEN · Seen Aug 2026
- Binary Tree Level-Order Traversal by LevelsPHONE SCREEN · ONSITE INTERVIEW · Seen Aug 2026
- Count Occurrences in a Sorted ArrayPHONE SCREEN · ONSITE INTERVIEW · Seen Jul 2026
- Count Pairs with Absolute Difference KPHONE SCREEN · Seen Jul 2026
- Count Subsets with Sum KPHONE SCREEN · Seen Jul 2026
- Numbers with Exactly Three DivisorsPHONE SCREEN · Seen Jul 2026
- Sum of Even Nodes on a Path in a Numbered Binary TreePHONE SCREEN · Seen Jul 2026
- Largest Value in Every Sliding WindowPHONE SCREEN · Seen Jul 2026
Similar questions at other companies
- Meeting Rooms IIeBay · PHONE SCREENeBay interview questions
- Meeting Rooms IIByteDance · PHONE SCREENByteDance interview questions
- Meeting Rooms IIAmazon · PHONE SCREEN · ONSITE INTERVIEW
- Maximum Number of Events That Can Be AttendedSnowflake · PHONE SCREENSnowflake interview questions
- Meeting Rooms IIRoblox · PHONE SCREENRoblox interview questions
- Minimum CPUs for Fixed-Duration JobsGoogle · PHONE SCREEN · ONSITE INTERVIEWGoogle interview questions
- Minimum Meeting RoomsSentry · PHONE SCREENSentry interview questions
- Minimum Meeting RoomsJP Morgan Chase · OAJP Morgan Chase interview questions
- Generate Complete Inputs for a Supplied ClassifierGeneral Motors · ONSITE INTERVIEW
- Meeting Rooms IISalesforce · ONSITE INTERVIEWSalesforce interview questions
Interview reports that mention this question
Adobe interview experiences
- Adobe Web, QA, DevOps, ML Roles: 13 Experiences (Part 3 of 3)
- Adobe SWE Interviews, Level Unknown: 25 Experiences (Part 2 of 3)
- Adobe Interviews, Level Unknown: 38 Experiences (Part 1 of 3)
- Adobe New Grad MTS Interview Questions: 7 Experiences
- Adobe ML/Research Intern Interviews: 12 Experiences (Part 4 of 4)