0258. Add Digits
https://leetcode.com/problems/add-digits
Description
Given an integer num
, repeatedly add all its digits until the result has only one digit, and return it.
Example 1:
Example 2:
Constraints:
0 <= num <= 231 - 1
Follow up: Could you do it without any loop/recursion in O(1)
runtime?
ac
Last updated