Search⌘ K
AI Features

Problem Involving Grids - 4

Explore dynamic programming strategies to solve a grid problem where two individuals start at opposite corners and meet only once to maximize their combined calories burnt. Understand how to build and use multiple DP tables that track different journey segments and compute optimal meeting points for this optimization puzzle.

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 ...