495. Armstrong Number
Given an integer n, return true if and only if it is an Armstrong number.
The k-digit number n is an Armstrong number if and only if the kth power of each digit sums to n.
Example 1:
Input: n = 9474
Output: true
Explanation: 9474 is a 4-digit number, and 9474 = 94 + 44 + 74 + 44 = 9474.
Example 2:
Input: n = 9475
Output: false
Explanation: 9475 is a 4-digit number, but 9475 != 94 + 44 + 74 + 54 = 9843.
Now Your Turn!
Pick the correct output for the given inputInput: n = 8208
Still unsure what the problem is asking ?
Let’s go through a few more examples, step by step, to make it clearer.
Constraints:
- 1 <= n <= 108