思路1 利用字符串list进行转换
我们创建一个字符串数组来存放结果,这个数组的长度就是numofRows
。遍历原字符串,不断的将遍历到的字符加载每一行的后面,遇到boundary
则改变step
的方向。这里的boundary
就是0和numofRows-1
。
在python中我们直接用''.join(list_name)
的形式把list
转换为字符串
Last updated
Was this helpful?
我们创建一个字符串数组来存放结果,这个数组的长度就是numofRows
。遍历原字符串,不断的将遍历到的字符加载每一行的后面,遇到boundary
则改变step
的方向。这里的boundary
就是0和numofRows-1
。
在python中我们直接用''.join(list_name)
的形式把list
转换为字符串
Last updated
Was this helpful?