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.
Very nice solution!
серйозно
Natural Intelligence
ai
Touch some grass bro
twoDecimalPlaces(1.005);
Thanks! 😊
Yeah, reduce itself doesn’t mutate the array, but since I used arr.pop() inside it, the array gets mutated during the process.
You're totally right — wrapping arr as [...arr] before sorting and reducing would make it safer and more idiomatic.
Appreciate the kind words!
You're absolutely right — mutating the original array is not a good practice in production code.
In this case, I went for brevity over purity, since Codewars tests don't reuse the input array.
Thanks for the constructive feedback!
I'll keep it in mind for cleaner and safer code outside of kata environments.
You are mutating the original array passed as an argument to the function. This is not allowed in real code.
Ha! I solved it in a similar way, but this is a step further as it also crunches down the numbers.
I love that you realised that you don't need a loop for that.
this is cleaaaannnnn
I was waiting for mr.OneLine, but didn't find.
what in oblivion...
Clever but doesn't pass n = 70 with node v18.
That was my solution at first.
But got:
expected 3226062132197576 to equal 3226062132197568
on perimeter(70)
Brilliant!
Loading more items...