This comment is hidden because it contains spoiler information about the solution
Array(n) creates an array of length n, [...Array(n)] creates an array filled with undefined, of length n.
Can you explain how you brought an array into the function without 'let arr = '?
I think, it is a good kata to solve it considering possibility of some chaotic touch in the initial data.
Lets say, someone has messed up the initial array and all that "apple-promo recursion beauty" is gone.
I like the kata - though I`ve spent a good 2.5 hrs to tune the loops right so they can work steady.
The point of a kata is to come up with a clever solution to a problem. The realization that lead to this answer is why this kata was written the way it was.
The point of this kata is "this solves the problem". IMO.
I don't get why this works?
WTH, facepalm, now we know why it is 8 kyu XD
What's the difference?
That's not a solution, that is just hard coding !