Sort Every Border Layer of a Matrix Clockwise

Given an n × m integer matrix matrix, partition it into concentric border layers:

  • Layer 0 is the outer border.
  • Layer 1 is the next border after removing the outer border.
  • Continue until...

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: