(start_hour, end_hour) integer tuples (end exclusive) for one evening. Write peak_hour(reservations) returning the hour with the most simultaneous tables occupied — the smallest such hour on ties. Sweep hour by hour over 0-23 counting overlaps.peak_hour([(18, 20), (19, 21), (19, 22)])
19
All three parties overlap during hour 19.
For each hour h, count start <= h < end.
max over hours with the count as key handles ties if you iterate ascending.