FunctionRacerProblemsRace

Armstrong Number

BeginnerMathPython, JavaScript, TypeScript, Java, C++

A number with k digits is an Armstrong number if the sum of each digit raised to the power k equals the number itself.

Return True if n is an Armstrong number and False otherwise.

Example 1

n 153
returns true

1 + 125 + 27 = 153.

Example 2

n 123
returns false

1 + 8 + 27 = 36, not 123.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More Math problems