Implement a calendar that can book events. Each event has a start and end time. A new event can be booked if it does not overlap with any existing event.
For example, book succeeds. Then book fails (overlaps). Then book succeeds (touching is okay). This is the online version of overlap detection. You cannot sort everything upfront because events arrive one at a time. You must check each new event against all existing ones.