Loading...
The Onion Layer
A hard Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- hard
- Seniority
- senior, staff
Problem
A matrix visualization tool needs to read 2D grid data in a spiral order for rendering a ring-by-ring animation. Given an m x n matrix of integers, return all elements in spiral order - starting from the top-left corner and moving clockwise, layer by layer.
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a sandboxed Docker environment and grades it instantly.