Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution:
- def convert(self, s: str, numRows: int) -> str:
- if numRows == 1:
- return s
- a = [""] * numRows
- x = 0
- count = 1
- for i in s:
- a[x] += i
- if x == 0:
- count = 1
- elif x == numRows - 1:
- count = -1
- x += count
- ans = "".join(a)
- return ans
Advertisement
Add Comment
Please, Sign In to add comment