You have a square matrix of unsigned integer values. Say, 5 + 5.
Each row of that matrix contains numbers from 1 to 5 (or to whatever length of the matrix), randomly sorted.
You can move through the matrix only one step at the time - either straight down, left-down or right-down.
Your challenge is to write a code that will start at the middle of the top row, and find the path down with the highest sum.
For the following matrix, you start in c/0. For this matrix the best path would be:
d/4 which scores
4+4+5+4+5 = 22.
This challenge comes from peledzohar here on DEV.
Want to propose a challenge idea for a future post? Email email@example.com with your suggestions!