Walking Robot Simulation II — LeetCode 2069 Python Solution
MediumDesignSimulation
- Problem
- #2069
- Reading time
- 2 min
- Source
- leetcode.com
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
| Measure | Complexity |
|---|---|
| Time | Varies by operation |
| Space | Varies by operation auxiliary |
Related problems
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.