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]. Java Solution 1 If more than one row and column left, it can form a circle and we process the circle. Otherwise, if only one row or column left, we process that column or row ONLY. public class Solution { public ArrayList
Read full article from LeetCode – Spiral Matrix (Java)
No comments:
Post a Comment