Minimum required cab.
Anonymous User
422

There are two city A and B.
For both the city the array of pairs is given. Each pair is the start time of a cab from current city and end time when the cab reached to other city.
The time window is given for a single day and in 24hr format.
You have to calculate minimum cab used to serve all the rides for that day.
Example -
City A -> [{"04:30", "07:00"}, {"09:32", "15:15"}, {"12:00", "16:00"}, {"23:00", "23:59"}]
City B -> [{"05:30", "14:00"}, {"07:10", "11:00"}, {"20:20", "22:22"}]

Ans - 3 cabs.
cab1 -> A1{"04:30", "07:00"} -> B2{"07:10", "11:00"}->A3{"12:00", "16:00"}->B3{"20:20", "22:22"}
cab2 -> B1 {"05:30", "14:00"} -> A4{"23:00", "23:59"}
cab3 -> A2{"09:32", "15:15"}

Comments (2)