Skip to content
U
uByte
Tutorials
🐹
Go
Beginner-friendly
🐍
Python
Clean & readable
🟨
JavaScript
Web & Node.js
☕
Java
Enterprise & OOP
🦀
Rust
Systems programming
⚙️
C++
Performance & control
💜
C#
.NET & game dev
Interview Prep
🎯
All problems
Browse every language
🐹
Go
🐍
Python
🟨
JavaScript
☕
Java
🦀
Rust
⚙️
C++
💜
C#
⚡
Daily challenge
One new problem every day
🎤
Interview simulator
Timed mock interview + AI debrief
💬
Interview experiences
Real stories shared anonymously
Certifications
📝
Certifications
Coding exams by language
🐹
Go
🐍
Python
🟨
JavaScript
☕
Java
🦀
Rust
⚙️
C++
💜
C#
U
uByte
// Spiral Matrix — MEDIUM
// Category: array
Given an `m x n` matrix, return all elements of the matrix in spiral order (clockwise from the top-left).
Example: matrix = [[1,2,3],[4,5,6],[7,8,9]]
Output: [1,2,3,6,9,8,7,4,5]
Spiral Matrix — Pro only
Sign up free to start solving problems. The daily challenge is always free — no account needed.
BEST VALUE
Yearly Pro
$49.99/year
Save $69.89 vs monthly
Monthly Pro
$9.99/month
Cancel anytime
Create free account →
Already have an account? Sign in
← Back to Java problems