Great kata. Reminded me how great mathematitian Euclides was.
Your algorithm is bad. With x and y being as big as few thousand, you may have to do around 1,000,000 iterations. Multiply this by 100 random tests and...
Most probably endless loop in your code.
Issue is kata-related, use question tag if you require help.
This comment is hidden because it contains spoiler information about the solution
I've passed tests average 500 ms but when I try to attempt I am facing with this error
Execution Timed Out
help me please
Me too. And I don't feel like maths help should be spoilers... this is after all a coding site, not a maths site. IMO spoilers should only be information that spoils how to implement the maths...
If you have a "naive looping" implementation (generally something an algorithm that times-out or takes a long time), think about ways you can eliminate or reduce loops.
Some general rules of thumb:
...and while you're at it, take some time to review the solutions of others after you finish:
Just lose yourself in the joy of learning something new. Having fun while gaining skill is the sweet spot you want to strive for. You might just find that your naive-looping code was the springboard you needed to appreciate ever better ways of expressing ideas in code. cheers!
yeah indeed! :D
Well, that means you need a better algorithm ;-)
I know well, it times out if I raise it too high :)
Seems already implemented
Not a suggestion ;-)
Yes, and a certain number in your program is too small ;-)