FastPrepMinimum Wait until the Next Bus
Problems/Minimum Wait until the Next Bus

Minimum Wait until the Next Bus

ZipRecruiter logoZipRecruiter● EasyFULLTIMENEW GRADOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Two ZipRecruiter OA reports describe HH:MM schedules, a current or query time, and choosing the minimum time difference. One describes the next bus, and another keeps the example 12:30 against 12:00 and 13:00. We supplied wrapping forward across days, what happens when the bus leaves exactly now, and the formatting. Our version is about 88% the same as the reported questions.

Every time is a valid 24-hour HH:MM string. Buses repeat daily. Return the minimum forward wait from current to any scheduled departure, formatted as HH:MM. A bus departing now has wait 00:00; departures earlier today are considered on the next day.

Function

minimumBusWait(schedules: String[], current: String) → String

Examples

Example 1

schedules = ["12:00","13:00"]current = "12:30"return = "00:30"

The next bus is 30 minutes away.

Example 2

schedules = ["08:15","09:00"]current = "08:15"return = "00:00"

A bus at the current time gives zero wait.

Constraints

  • 1 <= schedules.length <= 100000
  • All strings use exactly two hour digits, a colon, and two minute digits.

More ZipRecruiter Online Assessment questions

  • Four-Level Banking System with Scheduled PaymentsOA · Seen Oct 2026
  • Count Three-Digit Numbers with Distinct DigitsOA · Seen Oct 2024
  • Longest Frequency-Bounded SubarrayOA · Seen Oct 2024
  • Minimum Changes to Draw a YOA · Seen Oct 2024
  • Apply Binary State OperationsOA · Seen Sep 2024
  • Simulate Orchard Rot SpreadOA · Seen Sep 2024
  • Compare Odd- and Even-Index SumsOA · Seen Sep 2024
  • Coordinate Removals with Column GravityOA · Seen Sep 2024
  • Lexicographically Smallest End ReversalOA · Seen Sep 2024
  • Recursively Expanded Shell Command CountsOA · Seen Sep 2024

Similar questions at other companies

  • Identification Number Check DigitAbridge · OAAbridge interview questions
  • Count Substrings With Identical CharactersVirtu Financial · OAVirtu Financial interview questions
  • Count Multiples of Three with Two SevensHudson River Trading · OAHudson River Trading interview questions
  • Is This Date a Weekend?Salesforce · OASalesforce interview questions
  • Triple-Position Alphabet EncodingArm · OA
  • Closest ColorTwo Sigma · OATwo Sigma interview questions
  • Prime Number From a StringAdobe · OAAdobe interview questions
  • Sum Integer StringsIntuit · OAIntuit interview questions
  • Digit Changes for a Multiple of 9Nutanix · OANutanix interview questions
  • Count Times Using at Most Two DigitsLSEG · OALSEG interview questions

ZipRecruiter interview experiences

  • ZipRecruiter SWE OA, Level Not Reported: 23 Experiences
  • ZipRecruiter SWE Intern OA Scores: 4 Experiences
  • ZipRecruiter SWE New Grad OA: 9 Experiences
All ZipRecruiter interview questionsSee ZipRecruiter hiring insights
Saved
class Solution {
    public String minimumBusWait(String[] schedules, String current) {
        // Write your code here.
    }

}
Checking account…