Easy C++ solution || Leetcode Weekly Contest || Beats 95% || 
IntuitionThe code uses dynamic programming to find the maximum coins a robot can collect while moving from the top-left to the bottom-right of the grid. It main
# Intuition
The code uses dynamic programming to find the maximum coins a robot can collect while moving from the top-left to the bottom-right of the grid. It maintains a 3D DP table, where `dp[i][j][k]` represents the maximum coins collected at cell `(i, j)` with `k` neutralizations used. At each cell, the robot can either move from the left or from above, and if the cell contains a robber (negative value), it may neutralize the robbery (if it has unused neutralizations). The solution iterates through the grid and tracks the maximum coins possible while considering neutralizations and path choices.<!-- Describe your first thoughts on how to solve this problem. -->

# Approach

1. **🔍 Initialize the DP Table**:  
   Create a 3D DP table `dp[i][j][k]` to track the maximum coins collected at cell `(i, j)` with `k` neutralizations used.

2. **🚶‍♂️ Start from the Top-left**:  
   Set the starting point `(0, 0)` with the coins available or 0 if it's a robber. Initialize all other cells as negative infinity (`INT_MIN`).

3. **⬇️ Move Down and → Move Right**:  
   Iterate through each cell in the grid from left to right and top to bottom.

4. **💰 Update DP for Positive Coins**:  
   If the current cell has coins (positive value), update the DP table based on the maximum value from the top or left.

5. **💥 Neutralize Robbers**:  
   If the cell contains a robber (negative value), and you still have neutralizations left, use one to neutralize the robbery and update the DP table accordingly.

6. **🔄 Compare Results from Top & Left**:  
   For each cell, check the results from the previous cell in the row and column to choose the best path (with or without neutralization).

7. **🏁 Get the Maximum Coins**:  
   At the bottom-right cell `(m-1, n-1)`, get the maximum value considering all possible neutralization states (0, 1, or 2 neutralizations).<!-- Describe your approach to solving the problem. -->

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

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

# Code
```cpp []
class Solution {
public:
    int maximumAmount(vector<vector<int>>& coins) {
        int m = coins.size();
        int n = coins[0].size();
    
        vector<vector<vector<int>>> dp(m, vector<vector<int>>(n, vector<int>(3, INT_MIN)));
    
        for (int k = 0; k < 3; k++) {
            dp[0][0][k] = (coins[0][0] >= 0) ? coins[0][0] : ((k > 0) ? 0 : coins[0][0]);
        }
    
        for (int i = 0; i < m; i++) {
            for (int j = 0; j < n; j++) {
                for (int k = 0; k < 3; k++) {
                    if (i == 0 && j == 0) continue; 
                    int fromUp = (i > 0) ? dp[i-1][j][k] : INT_MIN;
                    int fromLeft = (j > 0) ? dp[i][j-1][k] : INT_MIN;
    
                    if (coins[i][j] >= 0) {
                        dp[i][j][k] = max(fromUp, fromLeft) + coins[i][j];
                    } else if (k > 0) {
                        int neutralize = max((i > 0 ? dp[i-1][j][k-1] : INT_MIN),
                                             (j > 0 ? dp[i][j-1][k-1] : INT_MIN));
                        dp[i][j][k] = max(max(fromUp, fromLeft) + coins[i][j], neutralize);
                    } else {
                        dp[i][j][k] = max(fromUp, fromLeft) + coins[i][j];
                    }
                }
            }
        }
    
        return max({dp[m-1][n-1][0], dp[m-1][n-1][1], dp[m-1][n-1][2]});
    }
};
```
['Dynamic Programming', 'Depth-First Search', 'Memoization', 'Matrix', 'C++']