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.
This comment is hidden because it contains spoiler information about the solution
guys ours looks the best 😎
I understand, thank you for the explanation!
Is there any difference between importing the library first opposed to doing Math.abs() ?
It is not best practice. The same people that go on leetcode that demands more of them and then downvote the problem come here to do their shenanigans and upvote the clever answers and call them a best practice. Bunch of 12 year olds.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
In this particular case it doesn't make sense.
Probably author had to cast while developing the solution and then forgot to remove it during final refactoring.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
I agree. it's not best practise, but it is clever :)
The tests internally use
float
s instead ofdouble
s which can lead to failing random tests.It's easy to fix, see the issue by @kayakero
I don't think it's the best practice. It's less code, however, it's much more resource consuming than a simple condition.
Loading more items...