Ctrl K

Smallest Digit Sum

Easy
You are given an array of positive integers numbers. Replace each number with the sum of its digits and return the smallest of the resulting values.
Example 1
numbers=[45, 302, 88] → 5

The digit sums are 4 + 5 = 9, 3 + 0 + 2 = 5 and 8 + 8 = 16. The smallest is 5.

Example 2
numbers=[1000, 7] → 1

1000 has a digit sum of 1, which beats 7 even though the number itself is larger.

Constraints
  • 1 ≤ numbers.length ≤ 100
  • 1 ≤ numbers[i] ≤ 10⁹
Have you seen this problem in a real interview?
Solved by0
Tried by0
Submissions0
Acceptance—
Topics
Similar problemsAdd One to a Digit Array EasyThe Lost Ticket EasyCorner Stamps on a Table EasyBest Product of Three EasyThe Biggest Triangle on the Board Easy
loading Python…
Input
numbers=[45, 302, 88]
Expected
5

Run checks the first 3 tests in your browser. Submit checks all 111 tests on the server, hidden ones included.