values. Compute two totals: the sum of the numbers themselves, and the sum of all the digits used to write them (every digit of every number, repeats included).
Return the absolute difference between the two totals.values=[24, 7, 100] → 117
The numbers add up to 24 + 7 + 100 = 131, the digits to 2 + 4 + 7 + 1 + 0 + 0 = 14, and the gap is 117.
values=[5, 9] → 0
Single-digit numbers are their own digits, so the gap is 0.
values=[24, 7, 100]
117
Run checks the first 3 tests in your browser. Submit checks all 82 tests on the server, hidden ones included.