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.
Can't do better than linear time, constant memory. I suspect something's fishy in the tests.
Sorry, late response. You can pass a block into
ls.combination(k)
instead of to the.map
function, which would allow you to exit early. However, the target distance is a limit, not a minimum. Since each combination you try might be higher than your last max and lower than the limit, we must visit every single combination to be sure of our answer.Good thinking though =D
The method name in the ruby version is "permsol", but the tests all look for a method called "permutations".
Sure, it's your kata. Sounds good to me!
Some suggestions:
The description could use some cleaning up. There's an abrupt cutoff after the first word, "block" is repeated one with formatting and once without, etc.
Sorry, I didn't actually mean to open an issue, CodeWars did that for me. How about "Calculating target date for compound interest"?
The title should be more descriptive.