Check Meeting Attendance With Breaks
Company: Mavenclinic
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Technical Screen
Quick Answer: This question evaluates proficiency with interval scheduling, time-format conversion, and constraint checking for sequential appointments, measuring algorithmic reasoning and attention to edge cases.
Constraints
- 0 <= len(intervals) <= 100000
- Each interval has exactly two strings: start and end
- Each time is a valid HHMM string from "0000" to "2359"
- For every interval, start < end and the appointment does not cross midnight
- 0 <= break_time <= 1440
- Appointments may be provided in any order
Examples
Input: ([["0900", "1000"], ["1015", "1100"], ["1130", "1200"]], 15)
Expected Output: True
Explanation: The gaps are 15 minutes and 30 minutes, so both satisfy the required 15-minute break.
Input: ([["0900", "1000"], ["1005", "1100"]], 10)
Expected Output: False
Explanation: There are only 5 minutes between 10:00 and 10:05, which is less than the required 10-minute break.
Input: ([["1300", "1400"], ["1330", "1500"]], 0)
Expected Output: False
Explanation: The second appointment starts at 13:30 while the first appointment is still in progress.
Input: ([["1500", "1530"], ["0900", "0930"], ["1000", "1100"]], 30)
Expected Output: True
Explanation: After sorting by start time, the gap from 09:30 to 10:00 is exactly 30 minutes and the later gap is much larger.
Input: ([["0000", "0030"], ["0030", "0100"], ["2350", "2359"]], 0)
Expected Output: True
Explanation: With no required break, an appointment may start exactly when the previous one ends.
Input: ([], 10)
Expected Output: True
Explanation: With no appointments, there are no conflicts.
Input: ([["0900", "1000"], ["0900", "1000"]], 0)
Expected Output: False
Explanation: Duplicate appointments completely overlap, so they cannot both be attended.
Hints
- Convert each HHMM time into minutes since midnight so time differences are easy to compare.
- Sort the appointments by start time, then compare each appointment with the previous one.