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.
Very nice. I was on my way down this path but got a bit lost in the math so I abandoned it. Should have stuck with it, very satisfying solution.
This comment is hidden because it contains spoiler information about the solution
Your solution is not displayed completely. Please, train this kata again and include the other foo's into scramble()
Yes, this one is
O(n^2)
. With a small change it can becomeO(n*sqrt(n))
: https://www.codewars.com/kata/reviews/55aa0d71c1eba8a65a000132/groups/5ab759b615c5933796000dff And I think there should be even better solutions possible.It's easily
O(n*sqrt(n))
. With precomputing a list of primes it's probably even better.