bookings[i] = [start, end] means a team holds a room from day start through day end inclusive. Two bookings cannot share a room if they have at least one day in common; for example, [1, 5] and [5, 8] clash.
Return the smallest number of rooms that can hold all the bookings.bookings=[[2, 4], [5, 7], [4, 6], [8, 9]] → 2
Bookings [2, 4] and [4, 6] share day 4, so two rooms are needed: for example [2, 4] and [5, 7] in one room, [4, 6] and [8, 9] in the other.
bookings=[[1, 10], [3, 3], [3, 5]] → 3
All three bookings cover day 3, so three rooms are needed.
bookings=[[6, 6]] → 1
bookings=[[2, 4], [5, 7], [4, 6], [8, 9]]
2
Run checks the first 3 tests in your browser. Submit checks all 97 tests on the server, hidden ones included.