MediumNo. 2069

Walking Robot Simulation II — LeetCode 2069 Python Solution

Topics
Design, Simulation
Reading time
2 min

The problem

A width x height grid is on an XY-plane with the bottom-left cell at (0, 0) and the top-right cell at (width - 1, height - 1). The grid is aligned with the four cardinal directions ("North", "East", "South", and "West").

Example

Input
["Robot", "step", "step", "getPos", "getDir", "step", "step", "step", "getPos", "getDir"]
Output
[null, null, null, [4, 0], "East", null, null, null, [1, 2], "West"]
Explanation
Robot robot = new Robot(6, 3); // Initialize the grid and the robot at (0, 0) facing East.

Complexity

Time
Varies by operation
Space · auxiliary
Varies by operation

Related problems

Related problems
No.ProblemDifficulty
0874Walking Robot SimulationMedium
0284Peeking IteratorMedium
0295Find Median from Data StreamHard
0307Range Sum Query - MutableMedium
0715Range ModuleHard
2276Count Integers in IntervalsHard

Frequently asked questions

How hard is LeetCode 2069. Walking Robot Simulation II?

LeetCode 2069. Walking Robot Simulation II is rated Medium on LeetCode.

What is the time complexity of LeetCode 2069. Walking Robot Simulation II?

The Python solution on this page runs in Varies by operation.

What is the space complexity of LeetCode 2069. Walking Robot Simulation II?

The Python solution on this page uses Varies by operation auxiliary space.

What topics does LeetCode 2069. Walking Robot Simulation II cover?

LeetCode 2069. Walking Robot Simulation II is tagged Design and Simulation on LeetCode.

Stuck on problems like this in a live interview?

Stealth Interview is a desktop app for macOS and Windows. It reads the problem off your screen and returns a working solution with a step-by-step explanation and its time and space complexity, invisible to screen sharing.

Free to download. Check it runs on your machine, then pick a plan.