FastPrepRepair One Movement Instruction

Repair One Movement Instruction

OpenAI logoOpenAI● MediumFULLTIMEOA

Problem statement

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.

The problem statement continues
Pro

Examples

Example 1

grid = [".T.","...",".S."]instructions = "FR"return = true

Replace R with F. The robot moves up twice and finishes on T.

Original screenshot from the interview report
Pro
FastPrep Pro
Reported in 1 OpenAI interview this week

Unlock 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
See OpenAI hiring insights
CodePython 3
Run and Submit unlock with Pro
FastPrep Pro
Reported in 1 OpenAI interview this week

Unlock 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