Explore more, and think twice, is this the life you want to live?
Entertainment
A trip to Fujiyama.
Learning
leetcode
identical problems and their solutions.
6. ZigZag Conversion
1
2
3
4
5
6
7
8
9
10
11
12
13
classSolution(object):defconvert(self,s:str,numRows:int)->str:n=len(s)lines=['']*numRowsindex=0# switch direction while at 0 or numRows - 1dir_=(numRows==1)-1forcins:lines[index]+=cifindex==0orindex==numRows-1:dir_=-dir_index+=dir_return"".join(lines)
3106. Lexicographically Smallest String After Operations With Constraint