Repair One Movement Instruction
Problem statement
You are given a rectangular character grid and a movement program.
Sis the unique start cell.Tis the unique target cell.#is an obstacle..is an open cell.
The robot starts on S facing up. Each character of instructions is one command:
F: move one cell forward.B: move one cell backward without changing direction.L: turn left in place.R: turn right in place.
You must replace exactly one instruction with a different command from F, B, L, and R. A candidate replacement is invalid if any move leaves the grid or enters an obstacle.
The problem statement continues
ProExamples
Example 1
grid = [".T.","...",".S."]instructions = "FR"return = trueReplace R with F. The robot moves up twice and finishes on T.
Original screenshot from the interview report
ProFastPrep Pro
Reported in 1 OpenAI interview this weekUnlock this recently reported problem
FastPrep Pro gives you full access to interview problems reported within the last week.
- Full problem statement and constraints
- 2 more worked examples, explained
- Guided hints and editorial
- Run your code on real test cases
$8.25/month
$99 billed yearly — or $19 month-to-month. Cancel anytime.
Free plan — 2 of 2 free unlocks used this week