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.
literally right there in the first word of your comment
Keep practicing, you can do it.
From the first paragraph of the Wikipedia article about
Y
(emphasis mine):Ditto, which is odd because I changed the test data to (1,1000000) and it passes. I assume that would be the largest range. Is there something I'm missing?
The kata is great.
Hint: Look at the series carefuly (Especially look at divisors, how it changes)
Read other solutions, see how could you make it shorter. And the number of lines doesn't necessarily reflect the kata's difficulty.
For this specific instance, its completely arbitrary. Doesn't make one difference.
There is a difference if you are wondering though. In the solution, he uses a pre-increment rather than a post increment like in your question. It increments the number before the statement executes. It doesn't make a difference because the only thing in that statement is '++i'. Here's an example of it:
FUN FACT: There is another difference but I'm not sure it applies to Javascript, but in C++ my professor once told me that, in a for-loop, pre-increments are much more efficient, and that big data companies always use pre-increments when applicable because of that. Could be the reason why its used here, I know I use it because of that fact lol.