Find any repeating vehicle program of at most ten commands with fuel and obstacles, using complete bounded search, terminating simulation, and explicit execution assumptions.
Find a Repeating Vehicle Program Under Fuel and Memory Limits
Company: Waymo
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: hard
Interview Round: Onsite
Find a short program for a vehicle on a grid. The vehicle starts at a specified interior cell with 100 fuel units. It can move up, down, left, or right, spending one unit per move, or refuel at a station to gain 50 units. Obstacles cannot be crossed. The vehicle can store at most ten commands and repeats that same program until it reaches any cell in the final column.
Return any program that succeeds, or report that none exists under the stated rules. No shortest program or minimum number of moves is required.
### Constraints & Assumptions
The source leaves execution details open. Use these explicit practice rules:
- Grid cells are free, blocked, or refueling stations. The supplied start is unblocked and not already in the last column. The map is finite and intended to be small enough for bounded-program search.
- Programs have length 1 through 10 over U, D, L, R, F. The instruction pointer wraps to zero after the last command.
- A move outside the grid, into an obstacle, or with zero fuel makes that candidate program fail. It does not cause the vehicle to wait or choose another direction.
- F is legal only at a refueling station, adds exactly 50 fuel, and does not move. No upper fuel capacity is imposed in this practice version because the source gives only initial fuel and refill amount.
- Reaching the last column succeeds immediately. A program that repeats forever without reaching it fails.
### Clarifying Questions
Is the storage limit at most ten commands or exactly ten? Is fuel capacity capped? Are illegal moves fatal or ignored? Can a station be reused? Does the program have conditional branches?
### What a Strong Answer Covers
A complete search space, faithful simulation, a termination argument despite possible loops, output validation, and an honest exponential complexity bound.
### Follow-up Questions
How would you prune invalid command prefixes or avoid equivalent repeated programs? Which additional constraints would justify a more sophisticated search? Why is ordinary shortest-path BFS insufficient when one fixed program must repeat?
Overview: Find any repeating vehicle program of at most ten commands with fuel and obstacles, using complete bounded search, terminating simulation, and explicit execution assumptions.
Find a Repeating Vehicle Program Under Fuel and Memory Limits
Waymo
Jun 27, 2026
hardSoftware EngineerOnsiteCoding & Algorithms
1
0
Find a short program for a vehicle on a grid. The vehicle starts at a specified interior cell with 100 fuel units. It can move up, down, left, or right, spending one unit per move, or refuel at a station to gain 50 units. Obstacles cannot be crossed. The vehicle can store at most ten commands and repeats that same program until it reaches any cell in the final column.
Return any program that succeeds, or report that none exists under the stated rules. No shortest program or minimum number of moves is required.
Constraints & Assumptions
The source leaves execution details open. Use these explicit practice rules:
Grid cells are free, blocked, or refueling stations. The supplied start is unblocked and not already in the last column. The map is finite and intended to be small enough for bounded-program search.
Programs have length 1 through 10 over U, D, L, R, F. The instruction pointer wraps to zero after the last command.
A move outside the grid, into an obstacle, or with zero fuel makes that candidate program fail. It does not cause the vehicle to wait or choose another direction.
F is legal only at a refueling station, adds exactly 50 fuel, and does not move. No upper fuel capacity is imposed in this practice version because the source gives only initial fuel and refill amount.
Reaching the last column succeeds immediately. A program that repeats forever without reaching it fails.
Clarifying Questions Guidance
Is the storage limit at most ten commands or exactly ten? Is fuel capacity capped? Are illegal moves fatal or ignored? Can a station be reused? Does the program have conditional branches?
What a Strong Answer Covers Guidance
A complete search space, faithful simulation, a termination argument despite possible loops, output validation, and an honest exponential complexity bound.
Follow-up Questions Guidance
How would you prune invalid command prefixes or avoid equivalent repeated programs? Which additional constraints would justify a more sophisticated search? Why is ordinary shortest-path BFS insufficient when one fixed program must repeat?