Same as problem 81, I used dynamic programming to solve this problem.
My algorithm goes through a input matrix and will build the shortest path from any cell in the first column to every other cell.
I do this by updating a mask of the given matrix with the shortest path to the respective cells, same tactic as Problem 81, except there are many more paths to check because we can move up and down.
I have added my code with comments below, please read the comments alongside the code to understand what is going on!
Nothing interactive here, code is given Below