You are viewing a single comment's thread. Return to all comments →
Java Solution
public static int superDigit(String n, int k) { if (n.length() == 1){ return Integer.valueOf(n); } long sum =0; for(int i=0;i<n.length();i++){ sum = sum + Character.getNumericValue(n.charAt(i)); } long value = sum*k; return superDigit(String.valueOf(value), 1); } } } }
Seems like cookies are disabled on this browser, please enable them to open this website
Recursive Digit Sum
You are viewing a single comment's thread. Return to all comments →
Java Solution