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 agree with paime. Given that Python uses C under the hood, I assume that the change of the sign is done like in C/C++, that is, the two's compliment. With that in mind, both -n and n*-1 are carried out by the same assembly instruction(optimised by the compiler) and should have on average the same execution time if you perform this an infinite amount of times. The n - n * 2 operation seems unreasonable to be the fastest since it involves two operations. Again, for a couple of executions the difference might not be obvious. But, for a sufficiently large amount of executions, the averages should have a distinct difference with the "n - n * 2" being the slowest. At least, theoretically.