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.
Hey it could be worst, i know how to use it and still used it wrong .-.
This comment is hidden because it contains spoiler information about the solution
Just as I clicked submit, I envivisioned (as I usually do) what the one line solution would look like and just as I thought of abs(), here it is. Dammit.
Poor guy, lol
I mean runtime because of an additional function call.
What do you mean by expensive? As in it takes a lot of system resources compared to over operations?
I am not sure where Codewars rules say thay you need to be as fast as possible :)
i mean, codewars is sbout doing it as fast as possible, even if its extremely ugly
-0 == 0 == +0, try it in the interpreter
Nice!
Just stop.
This comment has been reported as abusive
It's rather a function that can be called on a list to return it's length. But it is not exclusive to lists, can be used on many different types of objects.
How to do formatting
It does not matter. Any modern C compiler can optimize abs(x) and x < 0 ? -x : x equally. gcc 12 compiles both into the exact same code sequence.
Loading more items...