2269. Find the K-Beauty of a Number

Обновлено: 2024-03-12
1 мин
[]

Содержание

LeetCode problem 2269

class Solution:
    def divisorSubstrings(self, num: int, k: int) -> int:
        res = 0
        s = str(num)
        for i in range(len(s) - k + 1):
            t = int(s[i : i + k])
            if t and num % t == 0:
                res += 1
        return res