C++ || EASY TO UNDERSTAND || Memoization
\nclass Solution {\npublic:\n    int helper(int i,int j,int sum,vector<int> &stones,vector<vector<int>> &dp)\n    {\n        if(i>j)\n        return 0;\n       
```\nclass Solution {\npublic:\n    int helper(int i,int j,int sum,vector<int> &stones,vector<vector<int>> &dp)\n    {\n        if(i>j)\n        return 0;\n        if(dp[i][j]!=-1)\n        {\n            return dp[i][j];\n        }\n            return dp[i][j]=max(sum-stones[i]-helper(i+1,j,sum-stones[i],stones,dp),sum-stones[j]-helper(i,j-1,sum-stones[j],stones,dp));\n        \n        return 0;\n    }\n    int stoneGameVII(vector<int>& stones) {\n       int sum=accumulate(stones.begin(),stones.end(),0);\n        int n=stones.size();\n        vector<vector<int>> dp(n,vector<int>(n,-1));\n        int ans=helper(0,n-1,sum,stones,dp);\n        return ans;\n    }\n};\n```\n**Please upvote to motivate me in my quest of documenting all leetcode solutions(to help the community). HAPPY CODING:)\nAny suggestions and improvements are always welcome**
[]