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.
If you're not going to use the original later, you can change it. Maybe in a realife project, it is best to stay safe by making a copy.
Loved the way you solved it, when sorting is it good to do it in place or is it best practice to make a copy of the arr and then sort it?
Yes.
Is the underscore (_) mean that it's a placeholder we're not using ?
A reduce function which is easy to follow along, thanks :)
Love seeing a reduce function since I'm not fully comfortable with reduce
Dude , thanks for writing this comment. I'm more silly because I had in the instructions "If the score < 0, return 0" but still came here to check if something is wrong when I get -3
This is a bit easier to figure out that the code wars problem regarding interest and taxes on a initial principal
This comment is hidden because it contains spoiler information about the solution
What do you mean by the triangle already exists ? Are we not testing if the triangle could exist in our algo ? Sorry, I'm not fully understanding your question
Interesting, did not think of float values... It gives you an error when you input floating point values?
When you copy an array using the assignment operator (equal sign) and you modifiy the copied array you mutate/modify the original array as well.
If you don't want to modify the original array it's best to use spread syntax (other options as well to do this)
In our case, he assinged the a,b,c in an [array] first and secondly he assigned the value of running [sort] through it thus what's on the left will be exactly to what's on the right.
So when he returns [a and b] he knows that a trianlge can only have 3 lengths and they're the shortests.
Hope that answered your questions, let me know if you need clarification.
Thanks for pointing this out because I would have not realized.
Was wondering the same thing, thaks for asking. I added it a 'break' after every case for best practices but wasn't sure if I needed it.
Oh, I see what you mean, ty
Loading more items...