 DP | Tabulation | C++ | Easy 
IntuitionThe problem involves finding the maximum amount the robot can collect while neutralizing up to two robbers on its path from the top-left corner to the
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
The problem involves finding the maximum amount the robot can collect while neutralizing up to two robbers on its path from the top-left corner to the bottom-right corner. This can be solved using a bottom-up dynamic programming approach. The grid is traversed from the bottom-right corner to the top-left corner, and the dp array keeps track of the maximum profit the robot can gain at each cell with a certain number of robber neutralizations left.

# Approach:
**Dynamic Programming State**

Use a 3D dp array where dp[i][j][count] stores the maximum coins the robot can collect at cell (i, j) with count neutralizations remaining.
count ranges from 0 to 2, representing the number of robber neutralizations left.

**Base Case**

At the bottom-right corner (m-1, n-1), the profit is either:
coins[i][j] if no neutralization is used (count = 0).
max(0, coins[i][j]) if neutralizations are available (count > 0).


**For each cell (i, j):**
Consider moving down (i+1, j) or right (i, j+1).
If neutralizations are available (count > 0), check the maximum profit obtained by neutralizing the robber at the current cell.

**Result**

The maximum profit is stored in dp[0][0][2] (starting from the top-left corner with 2 neutralizations available).

**Edge Cases**
Small grids (e.g., 1x1 or 1xN).
Grids with only positive or only negative values.
Neutralizations may not always be beneficial.
<!-- 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(); // Number of rows
        int n = coins[0].size(); // Number of columns
        
        // 3D DP array initialized to INT_MIN to represent unvisited states
        vector<vector<vector<int>>> dp(m, vector<vector<int>>(n, vector<int>(3, INT_MIN)));
        
        // Iterate over the number of neutralizations (0, 1, 2)
        for (int count = 0; count < 3; ++count) {
            // Traverse the grid from bottom-right to top-left
            for (int i = m - 1; i >= 0; --i) {
                for (int j = n - 1; j >= 0; --j) {
                    // Base case: Bottom-right corner
                    if (i == m - 1 && j == n - 1) {
                        dp[i][j][count] = count > 0 ? max(0, coins[i][j]) : coins[i][j];
                        continue;
                    }
                    
                    int ans = INT_MIN; // Store the maximum profit for this cell
                    
                    // Check the cell below (down movement)
                    if (i + 1 < m) {
                        ans = max(ans, coins[i][j] + dp[i + 1][j][count]); // No neutralization
                        if (count > 0) ans = max(ans, dp[i + 1][j][count - 1]); // With neutralization
                    }
                    
                    // Check the cell to the right (right movement)
                    if (j + 1 < n) {
                        ans = max(ans, coins[i][j] + dp[i][j + 1][count]); // No neutralization
                        if (count > 0) ans = max(ans, dp[i][j + 1][count - 1]); // With neutralization
                    }
                    
                    // Update dp array for the current cell
                    dp[i][j][count] = ans;
                }
            }
        }
        
        // The answer is stored at the starting cell with 2 neutralizations available
        return dp[0][0][2];
    }
};

```
['C++']