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.
Thank you very much for the detailed answer.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
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!
Can someome please explain me why cant I do the assignment like this : ans[i] = str[i]; ?
Thanx
Clever use of qsort. I asked myself how to sort the ints like this with a single compare function. Thank you for the example. Maybe returning *a -*b or *b - *a could produce some overflows.
nah, I think it's to give extra space in case of memory overflow
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This is absolutely NOT "best practice", nor is it clever, as it's modifying a const string it will typically crash.
Really? https://stackoverflow.com/questions/4774456/pass-an-array-to-a-function-by-value
it crashes when you run it against the sample tests (button
TEST
), and passes when you run it against the full tests (buttonATTEMPT
). The sample and full tests are independent (they are in separate files).Trainer
page; they are only here so that you can get an idea of how your solution is called and which kind of inputs you can expect.usually, the sample tests are also copied to the full tests suite, but this is just a convention and authors can write tests differently. In this particular kata, the author of the C version did not do this: the sample tests call the user function with read-only string literals (which crashes this solution), but the full tests call it with mutable strings, so this solution can get away with removing
const
i think
int a[]
is a copy of array, so sorting it have no problem.Loading more items...