Dsa
Math
Hard
Armstrong Number Detector
An Armstrong number (also known as a narcissistic number) for a given number of digits n is a number that is equal to the sum of its own digits each raised to the power of n. For example, 153 is an Armstrong number because 1^3 + 5^3 + 3^3 = 153.
Input format:
- A single integer n (1 ≤ n ≤ 1000).
Output format:
- Return a list of Armstrong numbers up to n (inclusive) in ascending order.
Example:
Input:
1000
Output:
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 153, 370, 371, 407]
Key concepts
number_theorymathvalidation
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now