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.
You need not to go from
1
up ton
. You should find an optimal stopping point / upper-boundary where you can obtain all te divisors ofn
.It is an efficient solution.
I am afraid you should read again the description. This test is the same in all languages.
This comment is hidden because it contains spoiler information about the solution
Pleasure! Of course you might need a 'break' statement in some situations.
Oh man, while True is wonderful, thank you for showing it, I didn't know we can do such awesome thing.
This comment is hidden because it contains spoiler information about the solution
Which might necessitate tiebreaking on indices, which you will then have to make available.
Sometimes implementing your own
sort
is not the worst solution.Some really questionable design decisions have been made in JS ( EcmaScript ) historically, and this is one of them.
Recent specifications / implementations guarantee stable sorting, I think, but it's too late already and you can never fully trust sorting in JS. You'll always have to think about it.
Sort not being stable means you are not guaranteed how equal elements are ordered, and yes it's all over the place depending on engine or even it's version. To make sorting stable just define enough tiebreakers in a function passed to
sort
.Interesting. A boolean is subtracted from a boolean?
...true = 1,
false = 0, correct?
Ahh, very interesting... took me a good while to wrap my head around this one. Javascript's sort is hard to understand at first, but powerful!
Does this mean we should be implementing our own sort algorithms in Javascript? Or does it now have a stable sort?
Nice palindrome algorithm!
Your code is very hard to read
This comment is hidden because it contains spoiler information about the solution
console.log(start, end);
The value of the last fragment and the 3rd fragment are strongly hinted at in the example test cases. Plug those in first, then look at the expected results for the other tests.
Loading more items...