Given a gold mine represented by a grid of non-negative integers, return the maximum gold collectible when starting from any cell in the first column and moving only right, right-up, or right-down. Pattern focus: Grid Min Max Path DP. This is a classic maximum-sum grid traversal problem.
gold is a matrix of non-negative integers
maximum gold collectible
Example 1:
Input:
gold = [[1,3,3],[2,1,4],[0,6,4]]
Output:
12
Explanation:
The maximum gold that can be collected is 12.
Example 2:
Input:
gold = [[1,3,1,5],[2,2,4,1],[5,0,2,3],[0,6,1,2]]
Output:
16
Explanation:
The best route collects 16 gold.
Example 3:
Input:
gold = [[10]]
Output:
10
Explanation:
A single cell yields 10.