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 guess because the return type of countBits is set to size_t
Very similar to my solution, but I initialized the for loop at k = 0 and ended up having to use a do-while loop due to off-by-one issues. Glad to see we had the same thought!
Note this accesses memory from high-to-low, which is non-optimal for large address ranges. So I wouldn't call this a Best Practice.
This comment is hidden because it contains spoiler information about the solution
Yes, but no.
Please use decimal "ones" or "zeros" when counting in decimal - binary "ones" and "zeros", though technically the same, don't like it very much to be misgendered that way - because they identify as binary :D
Thats so nice and clean - tried similar, but didn't knew you could use a for-loop as a lazy while-loop like that and I
also wasn't sure if bitshift-equals is a legal expression.
why the use of
size_t
insead ofunsigned
?== 0 is false
< 0 is true ?
how the loop stops when value == 0? can you explain?
This comment is hidden because it contains spoiler information about the solution
many probs
I made such a dreadful solution in comparison to this one
yes, the uint32_t only allow integers without sign, this mean only can be positives
good luck passing your negative values when the params are unsigned ints.
would this still work if we give negative values to m and n?
Loading more items...