class Solution(object):
def fizzBuzz(self, n):
"""
:type n: int
:rtype: List[str]
"""
return ["Fizz" * (i % 3 == 0) + "Buzz" * (i % 5 == 0)
+ str(i) * (i % 3 != 0 and i % 5 != 0)
for i in range(1, n + 1)]
0412
最新推荐文章于 2023-04-12 19:58:30 发布