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.
This is so clean and readable. You're hired. 🤣
This comment is hidden because it contains spoiler information about the solution
Did you try using memoization with your recursive solution? - https://scotch.io/tutorials/understanding-memoization-in-javascript
Really clean and readable solution. Well done!
Okay, I'm an idiot, the while loop checks the condition on every iteration.
Hey Folks, I tried a while loop solution which was 0(n) that timed out, I tried a very similar solution using Array.reduce which was also 0(n) which completed very quickly. I know without sharing the code this may be difficult to answer (the internal workings of both solutions were very similar) but can anyone tell why there might be such a big difference between while and reduce. Thanks in advance, have a great day!!