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 used a function as the second argument, but I didn't we could do this.
Wow, fr clever
clever usage of var
now that
Array.prototype.sort()
is stable these solutions are correctOur solutions "pair" up nicely, twins if you will. 🤣🤣
Brute force should've been stated in the description of the code, but it does encourage people to write more efficent code.
I initally decided to generate all of the permutations and then give back the next biggest one but tests stopped me from doing that.
This comment is hidden because it contains spoiler information about the solution
ahhh! i was wondering that!
fixed
This comment is hidden because it contains spoiler information about the solution
Like it! Short and easily readable!!
It is based on the original language, so cannot be changed
same in Ruby with
[4,5]
expecting 1 instead of 0Yeah I don't think it would time out since n is being divided smaller like tacoslayer said. You are right that there's no need to keep iterating once it has reached the square root of the number,
BUUUUuuuuut, because this algorithm divides n each time it finds a factor, it will usually get cut short before then anyway. It would only iterate all the way through when n has been reduced to a prime number. not really such a problem generally... but there's no reason not to cut it off at the square root since not all prime numbers are small........it'd be the difference for example between iterating 151051 times and iterating only 388 times.
Loading more items...