You are given a list of meetings intervals. Each intervals[i] = [start_i, end_i] is one meeting that starts at start_i and ends at end_i.
Each meeting needs a room for its whole time, and a room can host only one meeting at a time. A room that is free from the moment a meeting ends can be used by a meeting that starts at that same moment.
Return the smallest number of rooms needed to hold all the meetings.
Examples
Example 1:
Input: intervals = [[9,11],[10,12],[11,13]]
Output: 2
Explanation: Between 10 and 11, two meetings run together. At 11 the first one ends, so the third one can use its room.
Example 2:
Input: intervals = [[1,5],[2,6],[3,7]]
Output: 3
Explanation: All three meetings run together between 3 and 5.
Example 3:
Input: intervals = [[1,2],[2,3],[3,4]]
Output: 1
Explanation: Each meeting starts when the last one ends, so one room is enough.