#K49667. Minimum Rooms Required
Minimum Rooms Required
Minimum Rooms Required
You are given several test cases. In each test case, you have a set of time slots represented by their start and end times. Your task is to determine the minimum number of rooms required so that no two overlapping time slots occur in the same room.
Two time slots \( (s_1, e_1) \) and \( (s_2, e_2) \) are considered overlapping if \( s_1 < e_2 \) and \( s_2 < e_1 \). For each test case, compute the minimum number of rooms needed.
Example:
Input: 2 3 10 20 15 25 20 30 2 1 5 6 10</p>Output: 2 1
In the first test case, you need 2 rooms because the time slots (10,20) and (15,25) overlap, while in the second test case, there is no overlap so only 1 room is required.
inputFormat
The input starts with an integer \( T \) representing the number of test cases. For each test case, the first line contains an integer \( n \), the number of time slots. Each of the next \( n \) lines contains two integers representing the start and end times of a time slot.
Input Format:
T n s1 e1 s2 e2 ...</p>(Repeated for each test case)
outputFormat
For each test case, output a single integer on a new line representing the minimum number of rooms required.
Output Format:
result1 result2 ...## sample
2
3
10 20
15 25
20 30
2
1 5
6 10
2
1
</p>