Leetcode 54: Spiral Matrix. Solution in Java
In this problem, we need to go through an array in a spiral pattern, clockwise, starting from the “top-left” of the array, and return all the elements in the order you encounter them. This is a exact question statement:
Given an
m x n
matrix
, return all elements of thematrix
in spiral order.
Here are a few examples used for testing:
