83. Minimum Platforms
MediumSortingSweep Line
Given arrival and departure times (as HHMM integers) of n trains, print the minimum number of platforms so no train waits. A train departing at the same time another arrives needs a separate platform.
Input format
Line 1: n Line 2: n arrival times Line 3: n departure times
Output format
The minimum number of platforms.
Example 1
Input
6 900 940 950 1100 1500 1800 910 1200 1120 1130 1900 2000
Output
3
Example 2
Input
2 900 1000 1000 1100
Output
2
Constraints
1 ≤ n ≤ 10⁵ arrival ≤ departure
Read input from standard input and print the answer to standard output. Your code is judged against 5 test cases, most of them hidden.
Loading the MyLoginn IDE…