티스토리 뷰

LeetCode

[LeetCode/Python] 412. Fizz Buzz

0hyeon의 2025. 5. 12. 16:55
반응형

 

 

 

3의 배수, 5의 배수 , 15의 배수일때에 따른 배열 출력

class Solution:
    def fizzBuzz(self, n: int) -> List[str]:
        return [ "Fizz"*(i%3==0) + "Buzz"*(i%5==0) or str(i) for i in range(1,n+1)]

 

배열안에서 바로 작업 

반응형

'LeetCode' 카테고리의 다른 글

[LeetCode/Python] 1672. Richest Customer Wealth  (0) 2025.05.10
[LeetCode/Python] 1480. Running Sum of 1d Array  (0) 2025.05.10
반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/06   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30
글 보관함