A calendar app joins events into busy blocks. Sort by start and scan once, say which ends count, then insert, sweep and intersect with the same order.
You work on a calendar app.