Given a non-negative integer num, repeatedly add all its digits until the result has only one digit, and return it.
num = non-negative integer
single-digit result after repeated digit sums
Example 1:
Input:
num = 38
Output:
2
Explanation:
3 + 8 = 11, then 1 + 1 = 2.
Example 2:
Input:
num = 0
Output:
0
Explanation:
0 is already a single digit.