본문 바로가기
python-algorithm

leetcode 2520. Count the Digits That Divide a Number

by 무적김두칠 2023. 1. 6.

https://leetcode.com/problems/count-the-digits-that-divide-a-number/description/

 

1
2
3
4
5
6
7
8
class Solution:
    def countDigits(self, num: int-> int:
        str_num = str(num)
        answer = 0
        for i in str_num:
            if num % int(i) == 0:
                answer+=1
        return answer
cs
반응형

'python-algorithm' 카테고리의 다른 글

leetcode 2367. Number of Arithmetic Triplets  (0) 2023.01.08
백준 10203 Count Vowels  (0) 2023.01.07
leetcode 2469. Convert the Temperature  (0) 2023.01.06
백준 10420 기념일 1  (0) 2023.01.04
백준 5220 Error Detection  (0) 2023.01.04

댓글