[LeetCode] 258. Add Digits - 문제풀이
Description 정수num이 주어졌을때 각 자리별로 한자리 수가 될때까지 더하여 반환하는 문제입니다. Given an integer num, repeatedly add all its digits until the result has only one digit, and return it. Example 1: Input: num = 38 Output: 2 Explanation: The process is 38 --> 3 + 8 --> 11 11 --> 1 + 1 --> 2 Since 2 has only one digit, return it. Example 2: Input: num = 0 Output: 0 Constraints: 0