Matrix boundary traversal: Return all values of a rectangular matrix in clockwise spiral order starting at the top-left corner.
Input: A JSON object { "matrix": number[][] }.
Output: A JSON number[] containing every matrix value exactly once.
Constraints:
- 0 <= matrix.length <= 1000
- All non-empty rows have the same length
- The output size equals rows multiplied by columns
Read one JSON value from stdin and print exactly one JSON-serialized answer to stdout with no extra text.
Difficulty: EASY. Variant: 22. Balance correctness, maintainability, and clear review-ready code.
Practice context
This coding (algo) exercise trains prompt interpretation, explicit assumptions, a concrete response, and a concise explanation of the decisions made. It is marked easy difficulty.
The signed-in workspace provides the tools required by the round, such as recording, code execution, diagrams