LeetCode題6——Z字形變換

問題描述: 解題思路: 創建一個具有numRows個元素的空列表,設置row=0,step=1,row+=step,一直到第numRows個元素,設置step=-1,直到回到row==0,循環以上步驟。 代碼實現: class Solution: def convert(self, s: str, numRows: int) -> str: if numR
相關文章
相關標籤/搜索