We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Difficulty: 中等
Related Topics: 数组, 矩阵, 模拟
给你一个 m 行 n 列的矩阵 matrix ,请按照 顺时针螺旋顺序 ,返回矩阵中的所有元素。
m
n
matrix
示例 1:
输入:matrix = [[1,2,3],[4,5,6],[7,8,9]] 输出:[1,2,3,6,9,8,7,4,5]
示例 2:
输入:matrix = [[1,2,3,4],[5,6,7,8],[9,10,11,12]] 输出:[1,2,3,4,8,12,11,10,9,5,6,7]
提示:
m == matrix.length
n == matrix[i].length
1 <= m, n <= 10
-100 <= matrix[i][j] <= 100
Language: JavaScript
/** * @param {number[][]} matrix * @return {number[]} */ var spiralOrder = function(matrix) { let n = [] while (matrix.length) { n = _.concat(n, matrix.shift()) matrix = _.reverse(_.zip(...matrix)) } return n };
The text was updated successfully, but these errors were encountered:
这里的 _. 是什么呀?
Sorry, something went wrong.
_是一个变量名。 这里是一个全局变量。
请问是在哪定义的呢,有文档吗找不到 QAQ
_是一个变量名。 这里是一个全局变量。 请问是在哪定义的呢,有文档吗找不到 QAQ
这里 _.xxx 肯定对应的是全局的 lodash 函数
No branches or pull requests
54. 螺旋矩阵
Description
Difficulty: 中等
Related Topics: 数组, 矩阵, 模拟
给你一个
m
行n
列的矩阵matrix
,请按照 顺时针螺旋顺序 ,返回矩阵中的所有元素。示例 1:
示例 2:
提示:
m == matrix.length
n == matrix[i].length
1 <= m, n <= 10
-100 <= matrix[i][j] <= 100
Solution
Language: JavaScript
The text was updated successfully, but these errors were encountered: