Buses in a Bustling Town

Problem Overview

  • Compute minutes since the last bus departure given a list of departure times and the current time.
  • Input: departure times and current time; Output: minutes since the most recent past departure, or -1 if none; a bus at the current time has not departed.
  • Real-world context: tracking a bustling town bus schedule to know how long ago the last bus left.
  • From Meta interviews; a coding interview problem and common interview question.

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: