beginner friendly easy maximising path sum problem(pattern dp)
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
```cpp []
class Solution {

int m,n;
vector<vector<vector<int>>> dp;
  int find(int i,int j,vector<vector<int>>& coins,int k){
      if(i>=m||j>=n){
          return INT_MIN;
      }
       if(i==m-1 && j==n-1){
           if(coins[i][j]<0 && k>0){
               return 0;
           } 
           else{
               return coins[i][j];
           }
       }
      
      if(dp[i][j][k]!=INT_MIN){
          return dp[i][j][k];
      }
       long long count=INT_MIN;
      if(coins[i][j]<0 && k>0)
      {
        count=max(count,1LL*0+find(i,j+1,coins,k-1));
         count=max(count,1LL*0+find(i+1,j,coins,k-1));
      }
       count=max(count,1LL*(coins[i][j])+find(i,j+1,coins,k));
       count=max(count,1LL*(coins[i][j])+find(i+1,j,coins,k));
      return dp[i][j][k]=count;
  }
   
public:
    int maximumAmount(vector<vector<int>>& coins) {
        m=coins.size();
        n=coins[0].size();
        dp=vector<vector<vector<int>>>(m+1, vector<vector<int>>(n+1, vector<int>(3, INT_MIN)));
        return find(0,0,coins,2);
    }
};
```
['C++']