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.
thanks. For the record, I readily admit it's not best practice, even if it always worked on every platform regardless of integer type.
it would still be undefined behavior though, even if it would happen to "work" on one specific platform. Signed overflow has undefined behavior in C/C++ and could result in anything. (unsigned overflow on the other hand is guaranteed to wrap around, so if the input were
unsignedit would be ok)Well, it would at least still pass the kata, for in this case overflow makes no difference to the outcomes.
wouldn't this be bad if we are using the biggest integers possible?
In my opinion, shouldn't be marked as best practices
How does this fare?
Very nice! I've seen/submitted one myself but it was using trig functions to hide the
if.challenge accepted (no
if, no ternary, no logic operators, but still not branchless 🙁 )But can you do it with zero IF statements?
Ahhhh yes, the nightmare of reducing IF statements to as mininum as possible....
This comment is hidden because it contains spoiler information about the solution
approved :]
Haskell translation
mashaallah :)
Here u can't. Use code redactors. For convience i am using an online redactor when using code wars.
Because this is not how Codewars work. See this article for some explanation.
Loading more items...