Simple DP Solution
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```python3 []
class Solution:
    def maximumAmount(self, coins: List[List[int]]) -> int:
        dp = {}
        def dfs(i, j, num):
            if i == len(coins) - 1 and j == len(coins[0]) - 1:
                if num > 0:
                    return max(coins[i][j], 0)
                return coins[i][j]
            if i >= len(coins) or j >= len(coins[0]):
                return float("-inf")
            if (i,j,num) in dp:
                return dp[(i,j,num)]
            if coins[i][j] >= 0:
                dp[(i,j,num)] = coins[i][j] + max(dfs(i,j+1, num), dfs(i+1,j, num))
                return dp[(i,j,num)]
            val = coins[i][j] + max(dfs(i,j+1, num), dfs(i+1,j, num))
            if num > 0:
                val = max(val, max(dfs(i,j+1, num-1), dfs(i+1,j, num-1)))
            dp[(i,j,num)] = val
            return dp[(i,j,num)]
        return dfs(0,0,2)
```
['Python3']