FastPrepVehicle Maintenance Event Readiness
Problems/Vehicle Maintenance Event Readiness

Vehicle Maintenance Event Readiness

Waymo logoWaymo● EasyFULLTIMEPHONE SCREEN
QuestionFunctionExamplesConstraints

Problem statement

Source note: The interview report supplies ordered maintenance events with open or end actions, times, and types such as oil and brake. It says every opened event must close and each type can have at most one active event at a time. It omits the row encoding, how invalid rows are handled, and bounds; the practice contract defines those details. The judged task matches the report at about 90%.

Each row in events is [action, time, maintenanceType]. Rows are ordered by nondecreasing integer time, and rows are processed in the given order. An OPEN row starts maintenance of that type, and an END row finishes the active maintenance of that type.

Each maintenance type can have at most one active event at a time. After a type ends, it may be opened again later.

A row is invalid when it opens a type that is already active or ends a type that is not active. The vehicle is ready exactly when no row is invalid and no maintenance event is still active after the last row.

Return whether the vehicle is ready.

Function

isVehicleReady(events: String[][]) → boolean

Examples

Example 1

events = [["OPEN","10","oil"],["OPEN","12","brake"],["END","20","oil"],["END","25","brake"]]return = true

Oil and brake maintenance overlap, but they are different types. Each one ends, so the vehicle is ready.

Example 2

events = [["OPEN","1","oil"],["END","4","oil"],["OPEN","8","oil"],["END","9","oil"]]return = true

Oil maintenance happens twice. The second OPEN comes after the first END, so the two oil events never overlap. Both end, so the vehicle is ready.

Example 3

events = [["END","3","brake"]]return = false

Brake maintenance is not active, so it cannot end.

Example 4

events = [["OPEN","1","brake"],["OPEN","2","brake"],["END","3","brake"],["END","4","brake"]]return = false

The second brake OPEN happens while brake maintenance is still active, so two brake events would overlap.

Constraints

  • 0 <= events.length <= 100000.
  • Each row contains exactly three strings in the format above.
  • Each action is OPEN or END.
  • Times are decimal integers in [0, 10^9] and are nondecreasing.
  • Maintenance types contain 1 to 40 visible ASCII characters.

More Waymo problems

  • Fixed-Order Task Run Time With CooldownPHONE SCREEN · Seen Oct 2026
  • Reorderable Task Scheduler With CooldownPHONE SCREEN · Seen Oct 2026
  • Island Area and Water BoundaryPHONE SCREEN · Seen Sep 2026
All Waymo interview questionsSee Waymo hiring insights
Saved
class Solution {
    public boolean isVehicleReady(String[][] events) {
        // Write your solution here.
    }
}
Checking account…