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.
Yes, but my point was that this isn't best practice.. just clever.
the description says the input will be all positive integers
Good, but if they were to pass negative numbers as an input and it would fail..
When I was trying to use this method it said me that it's wrong. WTF? 🤬
More concise than #1! Way to go!
agreed.
Question asks to solve when "given an array of minimum 4 POSITIVE integers"
it does not solve if there are negative or non-integer numbers in the array
why do we need to subtract a-b i dont understand its meaning or what it does
My own opinion - Its the best solution. Ever.
Remember you have to use the back-tick (`) or grave accent – usually in the top left of your keyboard – rather than apostrophes or quote marks!
This wasn't working for me. It's like the template string wasn't being parsed!
same issue. the correct output should be [1,2,3,4] not [1,0]
edit: (javascript)
Are you converting the numbers into strings? You should return the same value as original.
Unit tests seem to be wrong for this:
Passing in a value of [ 1, 2, 3, 4, 3, 2, 1 ] fails one test with the output of:
Expected: 10, instead got: 1234