Bottom-Up & Top-Down
Bottom-UpTop-Down
# Bottom-Up
```python3 []
class Solution:
    def maximumAmount(self, coins: List[List[int]]) -> int:
        m,n = len(coins),len(coins[0])
        dp = [[[float('-inf')] * 3 for _ in range(n)] for _ in range(m)]

        dp[0][0][2] = coins[0][0]
        if coins[0][0] < 0: dp[0][0][0] = dp[0][0][1] = 0

        for x in range(m):
            for y in range(n):
                for neutralize in range(2,-1,-1):
                    if x > 0: 
                        dp[x][y][neutralize] = max(dp[x][y][neutralize], coins[x][y] + dp[x-1][y][neutralize])
                        if neutralize < 2 and coins[x][y] < 0:
                            dp[x][y][neutralize] = max(dp[x][y][neutralize], dp[x-1][y][neutralize+1])
                    if y > 0: 
                        dp[x][y][neutralize] = max(dp[x][y][neutralize], coins[x][y] + dp[x][y-1][neutralize])
                        if neutralize < 2 and coins[x][y] < 0:
                            dp[x][y][neutralize] = max(dp[x][y][neutralize], dp[x][y-1][neutralize+1])
                            
        return max(dp[m-1][n-1])
```

# Top-Down
```python3 []
class Solution:
    def maximumAmount(self, coins: List[List[int]]) -> int:
        m,n = len(coins),len(coins[0])
        memo = [[[None] * 3 for _ in range(n)] for _ in range(m)]
        
        def dfs(x,y,neutralize):
            if x == m: return float('-inf')
            if y == n: return float('-inf')

            if (x,y) == (m-1,n-1): 
                return 0 if coins[x][y] < 0 and neutralize > 0 else coins[x][y]

            if memo[x][y][neutralize] is None:
                ans = coins[x][y]+max(dfs(x+1,y,neutralize),dfs(x,y+1,neutralize))
                if neutralize > 0 and coins[x][y] < 0:
                    ans = max(ans,dfs(x+1,y,neutralize-1),dfs(x,y+1,neutralize-1))
                memo[x][y][neutralize] = ans

            return memo[x][y][neutralize]
        
        return dfs(0,0,2)
```
['Dynamic Programming', 'Python3']