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

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

PE081

Page history last edited by Kenneth Finnegan 15 years, 7 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

PE081_c

 


Return to list of solutions

Comments (0)

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