Bus Time

Problem Overview

  • Determine how many minutes have passed since the last bus departed, given a schedule and the current 24-hour time.
  • Inputs: ordered list of departure times and a current time (HH:MM); Output: minutes since the last departure or an indication that none have departed; a bus at the exact current time is not yet departed.
  • Real-world context: public transit scheduling and time comparison.
  • From Uber interviews; a classic coding interview interview question and time-handling problem.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: