Skip to main content
LeetCode 1134, Easy. Topics: Math. View on LeetCode. Generate this problem as a practice environment: tested reference solution, 32 parametrized pytest cases, and a playground notebook:

Problem

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 k^th power of each digit sums to n.

Examples

Constraints

  • 1 <= n <= 10^8

Solution

Reference implementation from solution.py on GitHub, full suite in test_solution.py:

Complexity

Tags

NeetCode All.
Last modified on September 7, 2026