Minimum Wait until the Next Bus
Updated
Problem statement
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) → StringExamples
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