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.
You're right. I agree too.
I agree. very bad solution.
const arrLen = result.length; // one time length calculation
while(arrLen < n) {} // Don't need to calculate array length, just check for condition
while(result.length < n) {} // calculate array length on every loop, then check for condition
Definately not following the best practice around: 1) Creating pure function. 2) State mutation (arguments in this case). 3) Creating side effects.
Also, returning a new array (return signature.slice) after mutating the original arrary dones not make sense. Doing this before and running the for loop on the copy array and then returning it, would have made this solution perfect !!