Leetcode 2069. Walking Robot Simulation II
Simulate a robot on a width×height grid starting at (0,0) facing East that moves forward step-by-step and turns 90° counterclockwise whenever the next cell is out of bounds; implement step(num), getPos, and getDir. The key challenge is handling very large num efficiently by observing the robot's periodic movement around the grid perimeter and mapping a distance along that perimeter to a position and direction.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
0
Hello Interview Premium
Your account is free and you can post anonymously if you choose.