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.
This comment is hidden because it contains spoiler information about the solution
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.
Well, if a is
[]
and b is[]
, are they equal? :P There's still a small logical error in thatif
statement.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));
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!
Your solution is good enough in terms of performance for current tests (not that it's performant in general, the problem can be solved much faster, but for this kata and these tests, your solution is OK).
The problem with it, and the reason of timeouts, is that it does not handle some edge cases too well. There are inputs which cause it to get into infinite loop.
Hi @fr33mad, you will have to find a more efficient solution to pass the kata. Often the sample tests are only useful for checking if your code works in the most basic way, but then there are more tests when you click on ATTEMPT. This includes different tests, more diffuicult tests, edge cases, and random tests.