Accepted Java clear solution


  • 0
    L

    class Solution {
    public int addDigits(int num) {
    while(num/10!=0){
    num = num%10+num/10;
    }
    return num;
    }
    }


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.