# Robot in Circle - Company-specific OAs / Amazon OA

The implementation does not follow the leetcode assignement.
Leetcode assignement says possible movements are G,L,R.
And here in the implementation you are dealing with S,R

Here’s the updated version.

``````def is_robot_bounded( instructions: str) -> bool:
# Current position.
x, y = 0 , 0
# Direction
dx, dy = 0 , 1 # starts pointing to the north
for I in instructions:
if i == 'L':
dx, dy = -dy, dx #  0, 1 -> -1, 0, -> 0, -1
if I == 'R':
dx, dy = dy, -dx #  0, 1 -> 1, 0 -> 0, -1
if  i == 'G':
x = x + dx
y = y + dy

return (x, y) == 0 or (dx, dy) != (0, 0)
``````

The return statement should be:

``````    return (x, y) == (0, 0) or (dx, dy) != (0, 1)
``````
``````def is_robot_bounded(instructions: str) -> bool:
# Current position
x, y = 0, 0

# Direction
dx, dy = 0, 1  # starts pointing to the north

for i in instructions:
if i == "L":
dx, dy = -dy, dx  #  0, 1 -> -1, 0, -> 0, -1
elif i == "R":
dx, dy = dy, -dx  #  0, 1 -> 1, 0 -> 0, -1
elif i == "G":
x = x + dx
y = y + dy

return (x, y) == (0, 0) or (dx, dy) != (0, 1)
``````

You are right!, thanks!