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 comment is hidden because it contains spoiler information about the solution
That is not really clean code and also not best practice. It's "creative" to use
${n}
for converting the number into a string, i give you that (though other coders, who need to work on your code, need a short moment to understand WHY you are doing${n}
. Something liken.toString()
would be understandable in an instant).But the rest of the code is not good to maintain at all (just one line of code, you should definitely refactor this).
This comment is hidden because it contains spoiler information about the solution
Thanks! :) I'll check them out!
Sorry but no. I had recursion beaten into me while in Computer Science faculty. And once I got the basic idea of it, it just stuck with me.
But I can point you to algorithms with which I had first experience with recursion (all of them are sorting algorithms btw). Those algorithms are: QuickSort, MergeSort and HeapSort.
Also always keep in mind. Every recursive function can be turned into iterative function (for some stack may be needed (if they are not tail recursion)).
TL;DR for tail recursion: If the last thing you do in recursife function is a call to itself, than it is tail recursion. Like this solution :). And other solutions for this problem.
Also maybe check out the collection of books by Donald Knuth called The Art of Computer Programming, WIKIPEDIA. So far those books are far the best if you want to learn algorithms and how they work.
Hah, I bet, do you btw have any good books on recursion? My brain doesn't want to wrap its head around it you see...
Thanks.
Knowing ES6+ shortens your code alot. :)
This is brilliant <3