• If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • Stop wasting time looking for files and revisions. Connect your Gmail, DriveDropbox, and Slack accounts and in less than 2 minutes, Dokkio will automatically organize all your file attachments. Learn more and claim your free account.



Page history last edited by Kenneth Finnegan 12 years, 3 months ago

Project Euler Problem #81


The big challenge in this problem was to prevent paths from being recalculated, since this problem space is even larger than 67, which takes an unreasonable amount of time to brute force.


This caching was done with cache[][] and the first check in the minpath(x,y) function.  If the value has already been calculated, the function returns that value right away, saving time and unnecessary recursion.  It also proved to be a convenient way to signal the bottom right corner, by prefilling cache[79][79] with that squares value.


Runtime: 0.004 seconds



Return to list of solutions

Comments (0)

You don't have permission to comment on this page.