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
It is your code that throws this error. Don't forget to look at the stack trace in cases like this:
the problem comes from your code, you are assuming that
ordered
is zeroed, but since it's an output parameter it can contain anything when your function is called.this is not a
question
about the kata, you can write comments directly under solutionsThis comment is hidden because it contains spoiler information about the solution
Anyone else get the O(n) solution in JavaScript? Even though there's a (low) constant limit on the number of words, it was fun to write.
I like this kata.
This comment is hidden because it contains spoiler information about the solution
Very nice kata :)
This comment is hidden because it contains spoiler information about the solution
OP solved it, closing
OP solved it, closing
Your code fails for empty string input. Other than that,
return
the output instead of printing it.OP solved it, closing
This comment is hidden because it contains spoiler information about the solution
common mistake: you are using
strcat()
on uninitialized memory.strcat()
will scan for the first nul byte (\0
) in a string and start writing there. Your code assumes thatordered
starts with a nul byte, but the function's contract makes no such promise: it is an output parameter, so you must treat it as if it could contain arbitrary bytes before you write to it. I have updated the tests to make your code fail consistently.Loading more items...