老牛走世界

关注

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

老牛走世界

关注

阅读 29

2022-02-23


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

标签:字符串

解法

时间复杂度

空间复杂度

执行用时

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=" ")]



相关推荐

倪雅各

LeetCode题解(0139):单词拆分(Python)

倪雅各 60 0 0

宁静的猫

LeetCode题解(0758):字符串中的加粗单词(Python)

宁静的猫 178 0 0

大雁f

LeetCode题解(0422):有效的单词方块(Python)

大雁f 38 0 0

热爱生活的我一雷广琴

LeetCode题解(0624):数组列表中的最大距离(Python)

热爱生活的我一雷广琴 61 0 0

王小沫

LeetCode题解(0291):单词规律II(Python)

王小沫 53 0 0

念川LNSC

LeetCode题解(0212):单词搜索II(Python)

念川LNSC 63 0 0

热爱生活的我一雷广琴

LeetCode题解(0126):单词接龙II(Python)

热爱生活的我一雷广琴 62 0 0

码农K

Python打印列表中偶数

码农K 16 0 0

纽二

LeetCode题解(0244):最短单词距离II(Python)

纽二 37 0 0

杰森wang

LeetCode题解(0245):最短单词距离III(Python)

杰森wang 59 0 0

精彩评论(0)

0 0 举报