I can't see your current algorithms, but if you are taking n = b-a square roots, then, yes, there is a faster way. In that case, if you think more carefully about what is needed to solve the problem, you can probably find a simple way to speed things up without changing your algo very much.
Mednoob is correct. I'm marking this as resolved.
Looking at the tests, I can assure you that it accepts your answers. I think it's because
then
in your result. It should bethan
.This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
I can't see your current algorithms, but if you are taking
n = b-a
square roots, then, yes, there is a faster way. In that case, if you think more carefully about what is needed to solve the problem, you can probably find a simple way to speed things up without changing your algo very much.I am using math.sqrt to check for perfect squares. Is there a less time consuming approach?
I have passed all the tests but not the attempt session.