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...
For further actions, you may consider blocking this person and/or reporting abuse
My solution in js
So an easy "greedy" implementation isn't going to work for this one since it could easily happen that the best eventual path has the worst first move.
The problem does have a nice optimal substructure though, in that after you make a move, the path from there is the best one from that point, irrespective of what path you took to get to that point.
That points toward using dynamic programming to solve it.
Here's a JS impl: