AHHOUSE problem

Plz anyone Explain how to do this problem https://www.codechef.com/ISCC2017/problems/AHHOUSE/

Try using any one of the shortest path algorithms in Graph Theory like Dijkstra’s or Floyd Warshall. Think of the 2D Matrix as a graph with each cell as a vertex and each of its adjacent neighbors (up, down, left and right) as the neighboring vertices of that vertex.

1 Like

please explain approach for this question.i think backtracking is the main key here

see this link: http://www.geeksforgeeks.org/minimum-cost-path-left-right-bottom-moves-allowed/