LearnPy Hub
← Modules & the Standard Library problems
Hard

How Many Rooms Are Needed?

Read n meetings start end (end not included, so one ending at 10 frees the room for one starting at 10). Sort them by start and keep the end times of rooms in use in a heapq min-heap. Print the smallest number of rooms needed.

Input

n, then n lines.

Output

One integer.

Sample 1

Input
3
0 30
5 10
15 20
Output
2

Sample 2

Input
2
7 10
2 4
Output
1
solution.py
Output appears here
How Many Rooms Are Needed? · Python practice problem · LearnPy Hub