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.
Why do you need to do the a.idx - b.idx?
When can this kata get out of the beta process? Feel like it's been solved enough times and has been worked on to remove any kinks...
Ah, I forgot to restrict the use of join (makes the problem WAY too easy)...
The last test case is broken, I think... CODEWARS should not encode to CODEWARS...
Added! Thanks for the test case.
Some spelling errors in the kata. "imlementation"
Even though I'm checking even numbers, it shouldn't really take that much extra time. Since I'm going through @@prime.none?, the first prime should be 2 and it should really stop checking after it sees that the number is divisible by 2.
I think the second thing is probably what got me. Solved the problem anyways ;).
I find the description of this kata to be way too vague. What is the idea behind it? Is it monkey patching the base Ruby Date object? Writing our own method?
Modified the question to say, "accepts an integer greater than 1."
Will make a change regarding optimization.
Agreed. This kata should be deleted... Just a copy and paste from my earlier problems.
This comment is hidden because it contains spoiler information about the solution
Permutation is allowed... But codewars automatically times out during the run. Too evil?
Don't use puts... Just return the number... When you use
puts
as the last line of your method, you end up returning nil.That was intentional. Do you think I should allow for someone to use permutation? That's O(n!).
Woops! Fixing now.