Given an array of strings schedule
that represents the schedule of bus departure times and a string time
that represents the current time, find out how many minutes ago the last bus left. If the first bus for the day has yet to leave, return -1
.
Time is represented as a string in the form of HH:MM
(in the 24-hour format). Bus departure times are sorted in chronological order.
Please assume that if a bus is scheduled to leave at the current time, it hasn't left yet.
Note: You are not expected to provide the most optimal solution, but a solution with time complexity not worse than O(schedule.length * MINUTES_IN_DAY)
will fit within the execution time limit.
Example
For schedule = ["12:30", "14:00", "19:55"]
and time = "14:30"
, the output should be solution(schedule, time) = 30
.
我们长期稳定承接各大科技公司如TikTok、Google、Amazon等的OA笔试代写服务,确保满分通过。如有需求,请随时联系我们。
We consistently provide professional online assessment services for major tech companies like TikTok, Google, and Amazon, guaranteeing perfect scores. Feel free to contact us if you're interested.
