// you’re reading...
1 Star2 Stars3 Stars4 Stars5 Stars (23 votes, average: 4.83 out of 5)
Loading...

Project Euler Solutions

Project Euler 81 Solution

Project Euler 81 Solution

Project Euler 81: Find the minimal path sum from the top left to the bottom right by moving right and down.


Project Euler 81 Problem Description

Project Euler 81: In the 5 by 5 matrix below, the minimal path sum from the top left to the bottom right, by only moving to the right and down, is indicated in red and is equal to 2427.

131 673 234 103 18
201 96 342 965 150
630 803 746 422 111
537 699 497 121 956
805 732 524 37 331

Find the minimal path sum, in matrix.txt (right click and ‘Save Link/Target As…’), a 31K text file containing a 80 by 80 matrix, from the top left to the bottom right by only moving right and down.

Analysis

As with problems 18 & 67 we have a designated starting and ending place. We can use the same technique used to solve those problems by starting at the top-left and moving down, to the right, replacing each column with minimal sums. See those problems for further information.

Project Euler 81
This program and method
solves all test cases for
Project Euler 81 on HackerRank

Project Euler 81 Solution

Runs < 0.001 seconds in Python 2.7.
download arrowUse this link to get the Project Euler 81 Solution Python 2.7 source.

Answer

Slowly swipe from either end beginning with the white vertical bar to get an idea of the starting or ending digits. For less drama, just double click the answer area. The distance between the two bars will give you an idea of the magnitude. Touch devices can tap and hold the center of the box between the two bars and choose define to reveal the answer.
|427337|

Afterthoughts

Project Euler 81

Project Euler 81 Solution last updated

Discussion

No comments yet.

Post a comment