We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Another solution, using the same logic but different structure. I was getting stuck with the type of sum variable, where I was using int. Then I come here and I saw this solution, tks to share it.
Recursive Digit Sum
You are viewing a single comment's thread. Return to all comments →
Another solution, using the same logic but different structure. I was getting stuck with the type of sum variable, where I was using int. Then I come here and I saw this solution, tks to share it.
if(n.length() < 2) { return Character.getNumericValue(n.charAt(0)); }