One Line in Java


  • 0
    Y
    public static class Solution {
    	public  int addDigits(int num) {
    		return num>9?addDigits(num/10+num%10):num;
    	}
    }

Log in to reply
 

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