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.
- Recursive Digit Sum
- Discussions
Recursive Digit Sum
Recursive Digit Sum
Sort by
recency
|
603 Discussions
|
Please Login in order to post a comment
148, 3
1+4+8 = 13 1+3 = 4 4+0 = 4
Wrong Result = 4 Correct Result = 3
Bug
You should multiply this string n by k. So it is gonna be "148148148" not just "148". So basically (1+4+8) * 3 = 39 => 3+9=12 => 1+2 = 3
Here is my solution to this problem in Java
My code seems to work in Eclipse but it turns wrong in the test cases
I see it now, you are supposed to make it with recursion.
The test cases don't seem to work or am I missing something? Input (stdin) 148 3 Your Output (stdout) 4 (which is correct - 1+4+8 = 13, 1+3 =4) Expected Output 3
Agreed. So many problems here have incorrect test cases that are either just flat out wrong, or don't match the written requirements.
no it is true, 148 3 means 148148148 sum of its digits is 39. 39 -> 3 + 9=12. 12->1+2=3.
Thank you, didn't read it well enough...