Spiral Matrix Traversal with O(1) Extra Space

Given an m × n integer matrix matrix, return all of its elements in clockwise spiral order.

Requirements:

  • Use only O(1) auxiliary space, excluding the returned result array.
  • Do **not...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: