FastPrepMinutes since the Latest Departed Bus
Problems/Minutes since the Latest Departed Bus

Minutes since the Latest Departed Bus

ZipRecruiter logoZipRecruiter● EasyNEW GRADOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A ZipRecruiter new-grad OA report describes schedule times, a query time, considering only buses that have already left, and returning the minutes since the latest such departure. We supplied that an exact time counts, same-day scope, what happens before the first bus, ordering, and limits. Our version is about 89% the same as the reported question.

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) → int

Examples

Example 1

schedule = ["08:00","09:30","12:00"]current = "10:00"return = 30

The 09:30 bus departed thirty minutes earlier.

Example 2

schedule = ["08:00"]current = "08:00"return = 0

An exact departure gives zero minutes.

Constraints

  • 1 <= schedule.length <= 100000
  • Every time is exactly five characters in HH:MM form.

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
See ZipRecruiter hiring insights
Saved
class Solution {
    public int minutesSinceLatestBus(String[] schedule, String current) {
        // Write your code here.
    }

}
Checking account…