Spiral Matrix

来源:互联网 发布:防网络诈骗班会总结 编辑:程序博客网 时间:2024/05/18 02:46

Given a matrix of m×n elements (m rows, n columns), return all elements of the matrix in spiral order.
For example, Given the following matrix:
[
[ 1, 2, 3 ],
[ 4, 5, 6 ],
[ 7, 8, 9 ]
]
You should return [1,2,3,6,9,8,7,4,5].

0 0
原创粉丝点击