0
点赞
收藏
分享

微信扫一扫

LeetCode题解(1324):垂直打印列表中的单词(Python)


题目:​​原题链接​​(中等)

标签:字符串

解法

时间复杂度

空间复杂度

执行用时

Ans 1 (Python)

$O(N×max(

S

))$ : 其中S为字符串最大长度

Ans 2 (Python)

Ans 3 (Python)

解法一:

class Solution:
def printVertically(self, s: str) -> List[str]:
return ["".join(elem).rstrip() for elem in itertools.zip_longest(*s.split(), fillvalue=" ")]



举报

相关推荐

Python打印列表中偶数

0 条评论