Earliest Common Meeting Slot
Updated
Problem statement
Two people want to meet. slots1 lists the times when the first person is free and slots2 the times when the second person is free. Each slot [start, end] means free from time start to time end. The lists are not sorted.
Find the earliest meeting of length duration that fits inside one free slot of each person: return [t, t + duration] for the smallest start time t such that both people have a slot containing the whole range from t to t + duration. If no such time exists, return an empty array.
Function
earliestSlot(slots1: int[][], slots2: int[][], duration: int) → int[]Examples
Example 1
slots1 = [[40,60],[5,20]]slots2 = [[0,12],[45,70]]duration = 6return = [5,11]Person 1 is free from 5 to 20, person 2 from 0 to 12, so both are free from 5 to 12: 7 minutes, enough for 6. The meeting is [5,11]. (The lists are not sorted; [5,20] comes second.)
Example 2
slots1 = [[40,60],[5,20]]slots2 = [[0,12],[45,70]]duration = 8return = [45,53]The common time 5 to 12 is only 7 minutes. The next common time is 45 to 60 (15 minutes), so the earliest 8-minute meeting is [45,53].
Example 3
slots1 = [[40,60],[5,20]]slots2 = [[0,12],[45,70]]duration = 16return = []The common stretches last 7 and 15 minutes, both shorter than 16, so there is no slot: return [].
Constraints
1 <= slots1.length, slots2.length <= 1000- Each slot is
[start, end]with0 <= start < end <= 10^9 1 <= duration <= 10^6- Two slots of the same person never overlap or touch: one of them ends strictly before the other starts
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 IIUber · PHONE SCREENUber interview questions
- Meeting Rooms IIAmazon · PHONE SCREEN · ONSITE INTERVIEW
- Meeting Rooms IIWalmart · PHONE SCREENWalmart interview questions
- Minimum Machines for TasksExpedia · OAExpedia interview questions
- Intersect Multiple Interval ListsGoogle · ONSITE INTERVIEWGoogle interview questions
- Merge Overlapping IntervalsAtlassian · PHONE SCREEN · ONSITE INTERVIEWAtlassian interview questions
- Peak Chat Load Across AgentsCresta · PHONE SCREENCresta interview questions
- Sort Ones, Twos, and Threes In PlaceAgoda · PHONE SCREEN · ONSITE INTERVIEWAgoda interview questions
- Meeting Rooms IIeBay · PHONE SCREENeBay interview questions
- Minimum Rooms for Meeting IntervalsOYO Rooms · PHONE SCREEN
Interview reports that mention this question
Adobe interview experiences
- Adobe Web, QA, DevOps, ML Roles: 13 Experiences (Part 3 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)
- Adobe Product Intern Interviews: 15 Experiences (Part 3 of 4)