You are given arrival and departure times of all trains that reach a railway station. Find the minimum number of platforms required for the railway station so that no train is kept waiting.
Consider that all the trains arrive on the same day and leave on the same day. Arrival and departure time can never be the same for a train but we can have the arrival time of one train equal to the departure time of the other. At any given instance of time, the same platform can not be used for both departures of a train and the arrival of another train. In such cases, we need different platforms.
Input:
The first line contains space-separated integers that represent the arrival time of the trains.
The second line contains space-separated integers that represent the corresponding end time(24-hour format) of the trains.
Output:
The output should have an integer that represents the number of platforms needed to arrange the commute of all the trains.
Sample Input 1:
0900 1100 1235
1000 1200 1240
Sample Output 1:
1
Comments
Leave a comment