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.
While this is clever, I wouldn't consider it a best practice. It extends the range of allowed inputs to values whose cubes exceed the range that can be represented by the output type
/ 2
better conveys the intent, though. I'd recommend writing clear and idiomatic code—it's more readable for humans, and clearly identifiable patterns are also easier for the compiler to optimize.Additionally, bit shifts are easy to misuse: for instance, if the left-hand operand is negative, the behavior of a right shift is implementation-defined
What is actually happening here? How does negating a number result in a negative number less one? I can see that it works, but I'm not sure I understand?
True, but test passes! :D
True. Although probably not important for the 8th kyu. Thanks :)
This solution mught give incorrect result in case multiplication overflows