1134. Armstrong Number

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

Содержание

LeetCode problem 1134

class Solution:
    def isArmstrong(self, n: int) -> bool:
        k = len(str(n))
        s, x = 0, n
        while x:
            s += (x % 10) ** k
            x //= 10
        return s == n