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.
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?
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
Love the solution as I am trying to get better at regex this is what I was looking for. However, I don't fully understand why the second argument for replace is an empty array.
I tested it out and if I don't put it I get a marge larger length but not sure why.
I thought I marked it as spoiler, sorry
Loading more items...