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.
It's lazier; it works when
is
is infinite. I suspect (though I don't exactly recall) that's why I wrote it that way in the first place. Of course, the requirement to return the lexicographically least solution prevents doing anything useful with infinite lists, so it got transformed into this solution.If you're bothered by the possibility of creating nested loops, you could manually fuse it:
But I don't think that is necessary.
The real problem here is the use of
(!!)
, turning what should be a quadratic algorithm cubic.well spotted. thanks. Fixed.