[算法][LeetCode]Spiral Matrix——螺旋矩阵
摘要:题目要求Given a matrix ofmxnelements (mrows,ncolumns), 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].分析举个例子自己从头到尾把数字列出来,很容易就找到规律了:假设一维数组的坐标为x,取值范围是xMin~xMax;二维数组的坐标为y,取值范围是yMin~yMax。(也
阅读全文
posted @ 2013-10-31 18:43