Code Room
CodingMediumcod-g422
Subject SimulationLevel Mid–Senior~20 minCommon in Algorithms & data structures interviewsIndustries Software development

Question

A robot starts at the origin (0,0) of an infinite 2D grid facing north and executes a command string consisting of 'G' (move forward one unit), 'L' (turn left 90 degrees), and 'R' (turn right 90 degrees). The robot repeats the whole instruction sequence forever. Return True if and only if there exists some circle (of finite radius) that the robot can never escape — i.e. its trajectory is bounded. The instruction string has length 1..100.

Implement
is_robot_bounded(instructions: str) → bool
Examples
in["GGLLGG"]outtrue
What a strong answer looks like

State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.