Re: [閒聊] 每日leetcode

看板Marginalman作者 (通通打死)時間1年前 (2024/08/09 00:08), 編輯推噓1(103)
留言4則, 4人參與, 1年前最新討論串672/1549 (看更多)
剩我寫的一坨了== 寫得非常坎坷 唉 一二三四五 def spiralMatrixIII(self, rows: int, cols: int, rStart: int, cStart: int) -> List[List[int]]: diff = [0,1,0,-1,0] ans = [[rStart,cStart]] idx = 0 while len(ans) < (rows*cols): cur_i = idx for i in range((cur_i//2+1)): rStart += diff[cur_i%4] cStart += diff[cur_i%4+1] if 0<=rStart<rows and 0<=cStart<cols: ans.append([rStart,cStart]) idx += 1 return ans -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 125.229.37.69 (臺灣) ※ 文章網址: https://www.ptt.cc/bbs/Marginalman/M.1723133291.A.18D.html

08/09 00:08, 1年前 , 1F
大師
08/09 00:08, 1F

08/09 00:14, 1年前 , 2F
我的行數至少你的兩倍 漬
08/09 00:14, 2F

08/09 00:46, 1年前 , 3F
大師
08/09 00:46, 3F

08/09 00:48, 1年前 , 4F
py好爽java的白癡原生陣列難用死了
08/09 00:48, 4F
文章代碼(AID): #1cjErh6D (Marginalman)
討論串 (同標題文章)
文章代碼(AID): #1cjErh6D (Marginalman)