1
class Solution:
2
def getMaxLen(self, words):
3
max_len = 0
4
for word in words:
5
max_len = max(max_len, len(word))
6
return max_len
7

8
def printVertically(self, s: str) -> List[str]:
9
words = s.split()
10
max_len = self.getMaxLen(words)
11

12
res = list()
13
for i in range(max_len):
14
s = ""
15
for word in words:
16
if i < len(word):
17
s += word[i]
18
else:
19
s += " "
20
s = s.rstrip()
21
res.append(s)
22
return res

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0