You are viewing a single comment's thread. Return to all comments →
There is no recursion here, checkout my 3 line solution:
public static int superDigit(String n, int k) { BigInteger num=new BigInteger(n); int rem= num.remainder(new BigInteger("9")).multiply(new BigInteger(k+"")).intValue(); return rem%9==0?9: rem%9; }
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 →
There is no recursion here, checkout my 3 line solution: