C++, memozation, Minimax approach
\n    int memo(vector<vector<int>> & dp, vector<int>& stones, int sum, int start, int end){\n        if(sum <= 0) return 0; \n        if(start== end )return 0;\
```\n    int memo(vector<vector<int>> & dp, vector<int>& stones, int sum, int start, int end){\n        if(sum <= 0) return 0; \n        if(start== end )return 0;\n        if(dp[start][end]!= -1)return dp[start][end]; \n        \n        int res = max(sum-stones[start]- memo(dp,stones, sum-stones[start], start+1, end),\n                      sum-stones[end]- memo(dp,stones, sum-stones[end], start, end-1)\n                     );\n        return dp[start][end ] = res ;\n    }\n    int stoneGameVII(vector<int>& stones) {\n        int sum = 0 ;\n        int n = stones.size(); \n        for(auto x:stones) sum +=x;\n        vector<vector<int>> dp(n+1, vector<int>(n+1, -1)); \n        return memo(dp , stones, sum, 0, n-1) ;\n    }\n```
['Recursion', 'Memoization', 'C']