AHHOUSE problem

Plz anyone Explain how to do this problem CodeChef: Practical coding for everyone

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: Minimum Cost Path with Left, Right, Bottom and Up moves allowed - GeeksforGeeks