2020年1月20日leetcode04

ここに画像を挿入説明

def convert(self,s:str,numRows:int) ->str:
    if numRows<2:return s
    res=["" for _ in range(numRows)]
    i,flag=0,-1
    for c in s:
        res[i]+=c
        if i ==0 or i ==numRows -1:flag=-flag
        i+=flag
     return "".join(res)
公開された17元の記事 ウォンの賞賛0 ビュー257

おすすめ

転載: blog.csdn.net/dongxieaitonglao/article/details/104240364