Problem Involving Grids - 4

Use dynamic programming to solve a real-world interview problem based on grids.

Problem statement

Let’s discuss one more complex problem based on grids. It is another variant of the grid problems that we discussed earlier. The problem statement is given below. You are given a 2-D matrix A of n rows and m columns where A[i][j] denotes the calories burnt. Two persons, a boy and a girl start from two corners of this matrix. The boy starts from the cell (1, 1) and needs to reach the cell (n, m). On the other hand, the girl starts from the cell (n, 1) and needs to reach (1, m). The boy can move right and down. ...