Problems > Cheapest Path Through the Grid > Editorial

Cheapest Path Through the Grid — Solution & Editorial

Back to the Problem

dp[i][j] = cost[i][j] + min(top, left), rolling one row.

Complexity: O(NM)