Ad
  • Custom User Avatar

    I'm not sure how I can help without giving you the answer =/ All I can say is that: if both arrays are empty, result should be true, not false.

    Try again, and if you still don't understand, try asking on CW gitter channel.

  • Custom User Avatar

    Still dont understand

  • Custom User Avatar

    Well, if a is [] and b is [], are they equal? :P There's still a small logical error in that if statement.

  • Custom User Avatar

    I have a problem. How do I check if the string is empty? I used:
    if (a.length == 0 || or b.length || 0) {
    return false;
    }
    However, in test 4, both a = 0 and b = 0 so they expect true but I return false. Please help

  • Custom User Avatar

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

  • Custom User Avatar

    I'm afraid your logic isn't quite correct. You're failing the classic test of this kata - [2, 2, 3] and [4, 9, 9] - which should return false.

    You can also see some other tests that you're failing by simply printing input arrays, for example: System.out.println(java.util.Arrays.toString(a));

  • Custom User Avatar

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

  • Custom User Avatar

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

  • Custom User Avatar
  • Custom User Avatar

    I am not going to tell, and I leave it for you to figure out. A couple of hints tho:

    • you can print n to console and see what is the last n passed to the function before it hangs. Be careful tho, because with how CW works, not all logs can be visible when timeout occurs, and non-flushed output will be lost and left not visible. You might need to force the flush after every write (but you might not, it depends).
    • you can run your solution locally, on your machine, in a loop, for all numbers from 0 to 100. Or from 0 to 1000, or from 0 to one million, and see if it completes normally or hangs.

    Good luck!

  • Custom User Avatar

    Glad you figured it out. Always make sure to check how many people completed a given kata in your language. If it's at least 3-digit number, it's almost certain that tests are correct (unless it's some obscure edge case). Happy coding ^_^

  • Custom User Avatar

    Programmer error. My debug wasn't outputting the input value of a call that recurses. I can see the problem now, thanks.

  • Custom User Avatar

    My code passes all other tests including the random ones. Just one test it fails on.

    So I had already (before reporting) added a console.log to try and debug so I can see that the input is 43, and yet it fails with

    Log:
    43, 7 (the output from the console.log(original number, returned sum))
    Expected: 9, instead got: 7

    I labelled it an issue because it seemed to be an issue in the tests.

  • Custom User Avatar

    The tests are fine. Notice at the top: JavaScript Completions: 27850

    I don't see a basic test with 43 for JS. Maybe that's result of one of your logs (if you're using recursion, for example)

    Anyway, label issue is for actual problems with kata, not for issues with your code :P For that, use question label first.

    Feel free to reply to get it resolved, but you should start by reading the task again and logging stuff to console to debug your code.

  • Custom User Avatar

    JavaScript: One of the basic tests, 43 asserts the answer should be 9, but the answer should be 7.

  • Loading more items...