We use cookies for site analytics. Accept to help us understand how the site is used. See our Privacy Policy for details.
Nearly every interval problem opens the same way: sort by start time, then walk the list deciding whether the current interval overlaps the previous one. Merging, insertion, and "minimum rooms needed" are all variations on that single scan. Sorting by end time instead is the trick behind maximum non-overlapping scheduling.
Meetings, bookings, ranges, or anything with a start and an end.
8 problems. Each one runs in an in-browser editor against real test cases, with hints and a worked solution.
The patterns cheat sheet covers all of these in one page - what each one looks like in a problem statement, and the template that follows.