Reported September 2026
OpenAIsimulation

Repair One Movement Instruction

Reported by candidates from OpenAI's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live OpenAI OA. Under 2s to a working solution.
Founder's read

The OpenAI assessment reported in September 2026 hands you a robot on a grid, a string of F, B, L, R commands, and one rule that trips people up: you must change exactly one instruction, and the original program doesn't count even if it already lands on T. Example 2 exists to punish that mistake. Under the hood it's a simulation problem with a prefix and suffix trick. If you blank on the structure, StealthCoder is the invisible safety net running during the live OA, but the idea is small enough to hold in your head.

The problem

You are given a rectangular character grid and a movement program.
S is the unique start cell.
T is 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.
Return true if some valid replacement makes the robot finish on T after executing every instruction. Its final facing direction does not matter.

Function
canReachTargetWithOneReplacement(grid: String[], instructions: String) → boolean

Examples
Example 1
grid = [".T.","...",".S."]
instructions = "FR"
return = true
Replace R with F. The robot moves up twice and finishes on T.
Example 2
grid = ["T#","S."]
instructions = "F"
return = false
The original instruction reaches T, but it must be replaced. Each different command either turns in place or leaves the grid.
Example 3
grid = ["..T",".#.","S.."]
instructions = "FLRFF"
return = true
Replace the second command L with F. The repaired program FFRFF travels around the obstacle.

Constraints
1 ≤ grid.length, grid[r].length ≤ 100
Every row has the same length.
The grid contains exactly one S and one T.
Every other cell is. or #.
1 ≤ instructions.length ≤ 2000
instructions contains only F, B, L, and R.

Reported by candidates. Source: FastPrep

Pattern and pitfall

Brute force tries every position (2000) and every replacement (3), then re-simulates the whole string (2000). That's about 12 million steps, which is fine here. The cleaner route is to precompute the state (row, col, direction) before each instruction as a prefix. Then for each index and each different command, apply the replacement from the prefix state, reject it if it leaves the grid or hits #, and run the remaining instructions to the end. Check that every move along the way is valid and that the final cell is T. Pitfalls: forgetting that B moves opposite the facing direction without turning, accepting the unchanged instruction as a replacement, and ignoring invalid moves in the suffix. Direction at the end doesn't matter, so only compare the final cell. If the simulation drifts under time pressure, StealthCoder can cover you during the live OA.

Drill it cold or hedge it with StealthCoder. Either way, don't walk into the OA hoping you remember the trick.

If this hits your live OA

You can drill Repair One Movement Instruction cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Made for the candidate who got the OA invite this morning and has 72 hours, not six months.

Get StealthCoder

Related leaked OAs

⏵ The honest play

You've seen the question. Make sure you actually pass OpenAI's OA.

OpenAI reuses patterns across OAs. Made for the candidate who got the OA invite this morning and has 72 hours, not six months. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Repair One Movement Instruction FAQ

What's the trick in Repair One Movement Instruction?+

Simulate with a prefix state. Store the position and facing before each instruction, then for every index try the three other commands and run the rest of the string. Reject any move that leaves the grid or hits an obstacle. No clever data structure needed.

Is brute force fast enough?+

Yes. With 2000 instructions, 3 replacements each, and up to 2000 steps per simulation, you're near 12 million operations. That's fine. Prefix states just save you from re-simulating the start of the program every time.

Why does Example 2 return false?+

The original program already reaches T, but you must replace the instruction with a different command. In that grid, every alternative either turns in place or walks off the grid, so no valid replacement lands on T.

What edge cases should I test?+

Test a replacement that makes the suffix walk into a wall, B moving against the facing direction, and a single-instruction program. Also test the case where the unchanged program works but no replacement does. Direction at the end must not affect the answer.

How do I prepare in 48 hours for a question like this?+

Write a clean simulator function that takes a start state and a string and returns the final cell or invalid. Practice direction handling with a four-entry array and modular turns. Once the simulator works, the replacement loop is just three nested lines.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with OpenAI.

OA at OpenAI?
Invisible during screen share
Get it