• Custom User Avatar

    Added random tests to Coffeescript and Java.

  • 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

    This comment is hidden because it contains spoiler information about the solution

  • 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

    Dude i already read that thing so many times its too vague.I need actual help from someone.For me the code just kept running both test cases at once which outputted 16.
    Test case 1 = 16 , Test case 2 = 456,
    It kept outputting 1+6+4+5+6 = 16.
    It overrode the first test case and just submitted the solution for test case 2 to test case 1.Only when i deleted test case 2 and ran it individually did i get a correct answer but i cant do that for the actual attempt so i guess my method just doesnt work for these test cases.

  • 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
  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Guys can anyone help me as to why the kata seems to running boht test cases at once?My code is fine on netbeans but with the test cases it has a problem.

    Netbeans-Test case : 16 , Output = 7
    This Kata-Test case : 16 , Output = 15

    I really have no idea why its doing this but i can assume that this is becuase codewars might have a few buggy katas.

  • Custom User Avatar

    Nvm i already got the answer.I kept getting a StringOutOfBoundsException so i just didnt use arrays entirely.Thanks for your time and concern man.

  • Custom User Avatar

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

  • Custom User Avatar

    Doesnt really help me much.I did what they said and im still getting an error but when i run the code on netbeans its fine.

  • Loading more items...