Thursday, April 25, 2013

project euler problem 139

Pythagorean tiles

I checked my code. It runs for 13 seconds. I feel it unacceptable. 
I read the code just for one minute, then I found how to optimize it. The code run time reduced to 0.6 second.  I should have done the optimization immediately after I solved the problem!

I read the discussion and found that there was a better algorithm! Read it if your code runs more than 0.5 second.

No comments:

Post a Comment