Practice Path with Maximum Gold
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Each cell of grid contains its available amount of gold, with 0 indicating an empty cell. Start at any cell containing gold, move only up, down, left, or right, and stop wherever you choose. Collect all gold from every visited cell, never visit a zero-valued cell, and never visit the same cell twice. Return the maximum gold obtainable along one such path.
Source: Path with Maximum Gold on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
grid = [[0,6,0],[5,8,7],[0,9,0]]
24
# Example 2
grid = [[1,0,7],[2,0,6],[3,4,5],[0,3,0],[9,0,20]]
28
Constraints
Related LeetCode Problems
Practice more problems similar to Path with Maximum Gold.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.