This comment is hidden because it contains spoiler information about the solution
What I wanted to say was that PHP version should be as demanding as Python version :D
Tried several methods but kept failing the performance test with 999.999 long array.
After a while I googled for solution, most of them did not work for the same reason^^ until finaly found one that worked.
The same in JS! I kept failing on test with array of lenght 999.999.
Very interesting problem wich needs a happy idea to solve it efficiently. Maybe Gauss only would need 2 minutes to solve it but I needed some more time :)
Works fine, but please, fix the disproportion in performance requirements. In Python max number in array can be 1000000 while in PHP it's only 1300.
Actually, I should post it as an issue.
PHP version is much less performance demanding than the Python version. It took over 10s for my code to deal with it in Python, while the same algorithm in PHP did it in less than 2s.
In PHP max number in array is 1300, in Python 1000000. It's a glaring disproportion, please fix it.
A bit strange. How someone could kwow if solution is borderline or not
without precise criteria?
Not a kata issue. Some solutions are borderline, meaning they timeout sometimes, but don't other times.
I've tried my two different working solutions with loop, but couldn't
pass attempts because of 'Timeout' Error. Finally I made it without loop,
and successfully passed test and attempt. But among passed solutions I
notice one with loop. Curiously, I tried to pass with this variant, but
again 'Timeout' Error. How that solution have passed?
It works now.
Could it be you're using recursion and overflowing the stack?
My solution code is passing the tests without using loops. I tried 2 different approaches but it just keeps throwing an error.
RangeError: Maximum call stack size exceeded
at findNumber (test.js:4:20)
at template (test.js:33:16)
at Context.it (test.js:42:34)
CoffeeScript translation, if someone can review and approve.
Before solving the problem, repeat the arithmetic progression.