Digital root Wikipedia的解释 直接上公式: class Solution { public int addDigits(int num) { if(num == 0) return 0; return 1 + ((num-1)%9); } }