Company: Autodesk SDE intern on campus_9april
Difficulty: medium
Imagine you are managing a city's transit archive looking back at past bus departure records. You are provided with an array departure_times which lists when buses departed throughout the day. Your job is to determine how many minutes have passed since the most recent bus left the station. If no bus has departed by the current time, return -1 . Time is formatted as strings in HH:MM within a 24-hour clock. All departures are ordered chronologically. Assume that a bus scheduled to leave exactly at current_time has not yet departed. Note: You are not expected to provide the most optimal solution, but a solution with time complexity not worse than O(departure_times.length x MINUTES_IN_DAY) will fit within the execution time limit. Example For departure_times = ["12:30", "14:00", "19:55"] and current_time = "14:30" , the output should be solution(departure_times, current_time) = 30 . Explanation: At "14:30" , the last bus left at "14:00" , so it was 30 minutes ago. For departure_times = ["0