Back to problems

Find a Repeating Vehicle Program Under Fuel and Memory Limits

Algorithm · Waymo · Hard

Grid Rover with Repeating Program Medium · Backtracking, Simulation · Waymo · Hints: Use backtracking to generate all sequences of length 1–10; simulate each, pruning when a move would fail or a fuel‑less move is attempted. You are given a rectangular grid of rows by cols cells. Each cell is free ('.'), blocked ('#'), or a fuel station ('F'). A rover begins at an interior cell (startRow, startCol) that is always free and does not lie in the rightmost column. The rover starts…

Checking your access…