【leetcode刷題】59 spiral matrix II (python)

原題連接 https://leetcode.com/problems/spiral-matrix-ii 解題思路 用round記錄當前處於第幾輪,按照上右下左的順序不斷轉圈輸出便可。但須要注意的是當上下重合爲一行時須要判斷一下,停止程序。 代碼web class Solution(object): def generateMatrix(self, n): """
相關文章
相關標籤/搜索