LeetCode54.螺旋矩阵(Java实现)

链接:https://leetcode-cn.com/problems/spiral-matrix/

class Solution {
    public List spiralOrder(int[][] matrix) {
        ArrayList list=new ArrayList();
        if(matrix==null||matrix.length==0){
            return list;
        }
        int row=matrix.length;
        int col=matrix[0].length;
        boolean[][] status=new boolean[row][col];
        int len=row*col;
        int x=0,y=0;
        while(true){
            if(list.size()==len){
                break;
            }
            //向右
            while(y=0&&!status[x][y]&&list.size()=0&&!status[x][y]&&list.size()

 

你可能感兴趣的:(LeetCode编程题)