文字列のZ変換

 

 

 

 

クラスSolution(object):
    def convert(self、s、numRows):
        numRows == 1の場合:
            戻り値
        res = ['' for _ for range(numRows)]
        #サイクル
        T = numRows + numRows -2
        範囲内のi(len(s)):
            t_num%、T = T
            temp = t_num if t_num <numRows else numRows-(t_num)%numRows-2
            res [temp] + = s [i] 
        戻り値 '' .join(res)

おすすめ

転載: www.cnblogs.com/topass123/p/12695101.html