I know that there are other methods that may be more appropriate, but I don't see why mine succeed for all the tests of the IDE and not all of the validator.
I also already use something that is quite close to the least squares. Statisctics are not my favorite part of the mathematics, but I'm a math teacher, so roughly know how it works (even though I never looked at the method in particular).
I just find frustrating not knowing what is the problem with my program.
I assume that the main problem is that I'm assuming that if something is O(n^2) for example, it is roughly like k*n^2 for some k. But in fact, it is bounded by k*n^2 which is not exactly the same thing.
I prefer finding the problem in my program than just using some well known method. It is just less fun.