Minutes since the Latest Departed Bus
Updated
Problem statement
Every value is a valid 24-hour HH:MM time on the same day. Among departures no later than current, find the latest and return how many minutes have elapsed since it. A departure exactly at current returns 0. Return -1 when no bus has departed yet.
Function
minutesSinceLatestBus(schedule: String[], current: String) → intExamples
Example 1
schedule = ["08:00","09:30","12:00"]current = "10:00"return = 30The 09:30 bus departed thirty minutes earlier.
Example 2
schedule = ["08:00"]current = "08:00"return = 0An exact departure gives zero minutes.
Constraints
1 <= schedule.length <= 100000- Every time is exactly five characters in
HH:MMform.
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 · OA
- Count Substrings With Identical CharactersVirtu Financial · OA
- Count Multiples of Three with Two SevensHudson River Trading · OA
- Is This Date a Weekend?Salesforce · OA
- Triple-Position Alphabet EncodingArm · OA
- Closest ColorTwo Sigma · OA
- Prime Number From a StringAdobe · OA
- Sum Integer StringsIntuit · OA
- Digit Changes for a Multiple of 9Nutanix · OA
- Count Times Using at Most Two DigitsLSEG · OA