• Custom User Avatar

    Separated the assertions in diferent tests and added 100 random tests in Java.

  • Custom User Avatar

    I'd recommend you to read some particular paragraph in some very vague FAQ, but I won't ;)

    Look at spaces around 2.

  • Custom User Avatar

    You might have been tripped up by the fact that there's no log for the first test (16) because you passed it. So this is mistaken:

    This Kata-Test case : 16 , Output = 15

    Test case is actually 456. You'll see it if you print the input.

  • Custom User Avatar

    and what about this?

    continue reducing in this way until a single-digit number is produced.

    ...and why are you mixing the inputs of 2 different tests...????

  • Custom User Avatar

    Yes you are right, your method is wrong for 456. I just do not see how the code you pasted can produce the behavior you describe, that's why either I get you wrong, or you interpret something differently than it really is.

    What happens when you delete test case 1 and run only test case 2? For 456, valid answer is 6. Do you get locally answer 6 when you run your solution for n=456?

    It kept outputting 1+6+4+5+6 = 16.

    I don;t see how this can happen with your code and current tests. Is this exactly the output you get in logs?

  • Custom User Avatar

    Your code works correctly for 16 also here on Codewars. It works wrong for 456.

    Maybe this could explain why you probably misread the logs.

  • Custom User Avatar

    Then, following the instructions there, post your code here, so we can check what's wrong.

  • Custom User Avatar

    Read this