DP - Min Cost Path

Problem Statement Given a 2D matrix cost[][] of size MxN where cost[i][j] represents the cost of passing through cell[i][j]. Total cost of reaching a particular cell is the sum of costs of all cells in that path(including the start and end cell). We are allowed to move downward or rightward i.e. from cell[i][j] we can go to cell[i][j+1] or cell[i+1][j]. Find the min cost of moving from cell top left (0, 0) to bottom right (M-1, N-1)....

September 23, 2022 · 5 min · Ashish Gaur