1134. Armstrong Number

An Armstrong number (also called narcissistic number) is a k-digit number where the sum of each digit raised to the power k equals the number itself.

For example:

  • 153 is a 3-digit Armstrong number because 1³ + 5³ + 3³ = 1 + 125 + 27 = 153
  • 1634 is a 4-digit Armstrong number because 1⁴ + 6⁴ + 3⁴ + 4⁴ = 1 + 1296 + 81 + 256 = 1634

Given an integer n, return true if n is an Armstrong number, otherwise return false.

Examples
Input: 153
Output: true
Hints
Related Problems

1134. Armstrong Number

An Armstrong number (also called narcissistic number) is a k-digit number where the sum of each digit raised to the power k equals the number itself.