1134. Armstrong Number
On This Page
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
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