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.
I've been thinking about it too
you used an extra variable
r
in your code for the same purpose, only it was a pointer instead of an indexWhy do you need 'k' when you have 'count'?
Fixed.
The outputs for "expected" and "but was" are apparently swapped in the Java version, which is a bit confusing.
The kata was approved overnight when I do not have an access to my laptop.
However, I would like to ask you, what do you mean by
in C, the "value = 2" in description is never used
? The original task was made in Python and the author of the C translation did not change the description, stating that the description to the katas should be language-agnostic.About the definition of what "trace" is, I agree. By marking this task as "beginner-friendly", I should have stated the key things.
The one-liner code and the full description was written by me, only the idea of the task has been taken from the test makers. I missed that part in ToU, so thank you for pointing that out.
TIL on Wikipedia:
Indeed, it would be good to add this term & link to the description, as so many other katas also do.
Instructions could be improved. For example in C, the "value = 2" in description is never used. And later examples don't all state the values; nor do they define what a "trace" is.
indeed, iBits+2 instead of n+2... but i dunno why i even did a malloc instead of just a fixed sizeof(int)*8+2 byte array or something...
Resu can become unnecessarily huge for large values of n.
I guess great minds think similarlly ;).
That's really clever, but it's undefined C (that is, side-effect operations with binary operations yield undefined effects). And the strict defintion of "undefined behavior" means allowing the compiler to do anything it chooses.
cuz it looks beautiful!
looks elegant but inefficient indeed.
Loading more items...