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.
the testing code should be moved from preloaded to tests in C++
in Java,
assertArrayEquals
should be used instead of stringifying the arrays, which produces confusing assertion messagesyour solution is not robust because it uses a space separator that it then splits on to produce the pairs. that's assuming that the input string never contains spaces, which is not true in the random tests. not a kata issue.
the error comes from your code, you removed the
const
qualifier from the input (std::string &s
instead ofconst std::string &s
). As a result, the tests cannot find your function. this is a linker error, unrelated to the warning for comparison of signed and unsigned integers..
.
.
Why would you assume that? If test cases were wrong, the kata wouldn't be approved. The problem comes from the fact that:
1: you're mutating the input string (rarely a good idea)
2: the tests do not guard against this. First, your function is run with the mentioned string, which you mutate, and then the reference solution is run with what's left of the string, leading to unexpected results.
#2 is actually an issue, and should be fixed. I already see some issues raised below about it, and I'm amazed that this issue hasn't been fixed for 4 years or something?!
Still, I have to close it as duplicate (for now). Try to avoid mutating input where possible.
i'm assuming the test cases are incorrect? (ruby)