---
title: "Discussion on \"54. Spiral Matrix\" | Hashnode"
description: "Discussion on \"54. Spiral Matrix\". Problem Statement\nGiven an m x n matrix, return all elements of the matrix in spiral order. (link)\nExample 1:\n\nInput: matrix = [[1,2,3],[4,5,6],[7,8,9]]\nOutput: [1,2,3,6,9,8,7,4,5]\n\nExample 2:\n\nInput: matrix = [[1,2,3,4],[5,6,7,8],[9,10,11,12]]\nOutpu..."
url: "https://hashnode.com/posts/54/658f0796dfe3d75b2c824eeb"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [54\. Spiral Matrix](https://chetan77.hashnode.dev/54?utm_source=hashnode&utm_medium=feed)

Problem Statement Given an m x n matrix, return all elements of the matrix in spiral order. (link) Example 1: Input: matrix = \[\[1,2,3\],\[4,5,6\],\[7,8,9\]\] Output: \[1,2,3,6,9,8,7,4,5\] Example 2: Input: matrix = \[\[1,2,3,4\],\[5,6,7,8\],\[9,10,11,12\]\] Outpu...

Dec 29, 2023 · 2 min read · chetan77.hashnode.dev  
Updated Aug 28, 2024  
Read the article

-   [#spiralmatrix](https://hashnode.com/tag/spiralmatrix)
-   [#striversa2zdsa](https://hashnode.com/tag/striversa2zdsa)
-   [#leetcode](https://hashnode.com/tag/leetcode)
-   [#arrays](https://hashnode.com/tag/arrays)
-   [#software-development](https://hashnode.com/tag/software-development)
-   [#dsa](https://hashnode.com/tag/dsa)

## Written by

[Chetan Datta](https://hashnode.com/@chetan77)

@chetan77 · Hyderabad, India

  
[View profile](https://hashnode.com/@chetan77)

Software Engineer

I share my learnings here. Thanks for reading.

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
