Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
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.
Still dont understand
Well, if a is
[]
and b is[]
, are they equal? :P There's still a small logical error in thatif
statement.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
This comment is hidden because it contains spoiler information about the solution
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));
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Thanks buddy!
I am not going to tell, and I leave it for you to figure out. A couple of hints tho:
n
to console and see what is the lastn
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).Good luck!
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 ^_^
Programmer error. My debug wasn't outputting the input value of a call that recurses. I can see the problem now, thanks.
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.
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, usequestion
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.
JavaScript: One of the basic tests, 43 asserts the answer should be 9, but the answer should be 7.
Loading more items...