Minimum Platforms
Mediumjavapythonccppjavascript
Given the arrival and departure times of N trains at a station, find the minimum number of platforms needed so that no train waits. A platform is needed if a train arrives before or at the same moment another departs.
Input Format
The first line contains an integer N. The second line contains N space-separated integers — the arrival times. The third line contains N space-separated integers — the departure times.
Output Format
Print the minimum number of platforms required.
Example 1
Input
6 900 940 950 1100 1500 1800 910 1200 1120 1130 1900 2000
Output
3
Explanation: At one point three trains are at the station at the same time.
- 1 <= N <= 100000
- 0 <= arrival[i] <= departure[i] <= 1000000000