Repeatedly add all the digits of num until a single digit remains, and return it.
num
num = 38
2
Why
3 + 8 = 11 → 1 + 1 = 2
num = 0
0
0 <= num <= 2^31 - 1
Topics
Implement addDigits in the editor and return the answer — printing it is never graded.
addDigits
Problem 69 of 1146 in the arena