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.
I was going to say something similar, it's much more efficient to leverage a heap. Not nearly as pretty tho
You really only want to use recursion when there's a big benifit to it, like in dynamic programming where you are caching the results of subproblems. It's also really good for generating permutations, lists, variations, etc. Using recursion on a problem like this is actually a bad idea though and is the easiest way to end up with a stack overflow on what is a pretty simple problem.
While loop, recursion can blow up your stack on large data sets
I believe you're trying to do something on an empty list that can't be done on an empty list. I had the same error, but don't remember exactly what I did to fix it.