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.
It runs the same as n%2 because compilers turn it into a bit test, it only runs faster with optimizer turned off. I used it because once you're familiar with bit ops, it becomes a self-explanatory idiom.
clever use of bitshifting, probably runs very fast!
Yes, if returning a static label. It points to program data segment.
Is it considered best practice just to return a char* like this without allocating memory with calloc or malloc?
Where is the pointer stored - on the stack or heap?
Great job! Imo modulo is more readable but bit AND is cool as hell.
Added
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!
This comment is hidden because it contains spoiler information about the solution
How come it is not necessary to allocate memory for the returned strings? I see that it works but is it a good practice?
This comment is hidden because it contains spoiler information about the solution
How does it work?
This comment is hidden because it contains spoiler information about the solution
that's not what the description says.
Anyway, the ref solution was incorrect for empty arrays. Corrected.
Loading more items...