剑指offer29 顺时针打印矩阵
题目描述
输入一个矩阵,按照从外向里以顺时针的顺序依次打印出每一个数字。
示例 1:
1 | 输入:matrix = [[1,2,3],[4,5,6],[7,8,9]] |
示例 2:
1 | 输入:matrix = [[1,2,3,4],[5,6,7,8],[9,10,11,12]] |
限制:
0 <= matrix.length <= 100
0 <= matrix[i].length <= 100
解题思路
方法一:矩阵
根据矩阵的大小来进行输出
代码实现
1 | class Solution29 { |
资料
https://leetcode-cn.com/problems/shun-shi-zhen-da-yin-ju-zhen-lcof/
剑指offer29 顺时针打印矩阵
You need to set
install_url
to use ShareThis. Please set it in _config.yml
.