The Count Days Without Meetings interview question gives you a total number of days days and an array of meeting intervals [[start, end]]. You need to count how many days have no meetings scheduled. Meetings can overlap, so you must first merge the intervals to find the total number of unique days that are "busy."
Microsoft, Amazon, and Google use the Sorting interview pattern for this problem because interval merging is a fundamental software engineering task. It evaluates whether you can handle overlapping ranges and boundary conditions. It’s a "Medium" difficulty task that tests your ability to clean up messy data before performing a calculation.
The core pattern is Interval Merging.
[1, 3] and [3, 5] merge into [1, 5].(end - start + 1) for each merged interval.total_days - total_busy_days.Total Days: 10. Meetings: [[1, 3], [2, 4], [8, 8]]
[1, 3], [2, 4], [8, 8].[1, 3] and [2, 4] -> [1, 4].[1, 4] and [8, 8].(4 - 1 + 1) + (8 - 8 + 1) = 4 + 1 = 5.10 - 5 = 5.
Result: 5.end - start instead of end - start + 1 to count the number of days in an inclusive interval.Interval problems are extremely common. Practice the standard "Merge Intervals" template until you can write it flawlessly. It’s the foundation for many calendar and scheduling features.
| Title | Difficulty | Topics | LeetCode |
|---|---|---|---|
| Check if Grid can be Cut into Sections | Medium | Solve | |
| Maximum Consecutive Floors Without Special Floors | Medium | Solve | |
| Reduction Operations to Make the Array Elements Equal | Medium | Solve | |
| Sort the Jumbled Numbers | Medium | Solve | |
| Remove Covered Intervals | Medium | Solve |