PEC-CSS/Open-Source

Min Sum Path: DP

Gauravsharma-20 opened this issue · 2 comments

Given an integer matrix of size m*n, you need to find out the value of minimum cost to reach from the cell (0, 0) to (m-1, n-1).
From a cell (i, j), you can move in three directions : (i+1, j), (i, j+1) and (i+1, j+1).
Cost of a path is defined as the sum of values of each cell through which path passes.

Input Format :
Line 1 : Two integers, m and n
Next m lines : n integers of each row (separated by space)

Output Format :
Minimum cost

Sample Input :
3 4
3 4 1 2
2 1 8 9
4 7 8 1
Sample Output :
13

Hello @Gauravsharma-20 , can I work on this problem?

Go ahead. I'll assign it to you.