Given the arrival and departure times from the N trains that reach the train station for this platform k, return the maximum number of trains that we can place on the platforms k.
k <<< N
Arrival and departure times Array
Input: arr[] = {9:00, 9:40, 9:50, 11:00, 15:00, 18:00}
dep[] = {9:10, 12:00, 11:20, 11:30, 19:00, 20:00}
In some interview this question was asked to me, so why is this the best algorithm? This question is slightly modified from this question.
http://www.geeksforgeeks.org/minimum-number-platforms-required-railwaybus-station/
I tried the greedy algorithm for this question, but it does not work for all test cases.
source
share