C++ || RECURSION + MEMOIZATION + PREFIX_SUM
```\nclass Solution {\npublic:\n    int dp[1001][1001];\n    \n   \n    int solve(vector& stones, int i, int j, vector& pre_sum){\n         if(i >= j) return 0;
```\nclass Solution {\npublic:\n    int dp[1001][1001];\n    \n   \n    int solve(vector<int>& stones, int i, int j, vector<int>& pre_sum){\n         if(i >= j) return 0;\n         if(i + 1 == j) return max(stones[i], stones[j]);\n         if(dp[i][j] != -1) return dp[i][j];\n        // option 1 to choose the ith index value\n        \n        \n        int op1;\n        op1 = pre_sum[j] - pre_sum[i] - solve(stones, i + 1, j, pre_sum);\n        \n        \n        \n        \n        // option 2 to choose the jth index value\n        int op2;\n        op2 = pre_sum[j-1] - (i == 0 ? 0 : pre_sum[i-1]) - solve(stones, i, j - 1, pre_sum);\n        \n        return dp[i][j] = max(op1, op2);\n    }\n    \n    int stoneGameVII(vector<int>& stones) {\n         int n = stones.size();\n         memset(dp, -1, sizeof(dp));\n         vector<int> pre_sum(n,0);\n         pre_sum[0] = stones[0];\n         for(int i =1; i<n; i++){\n             pre_sum[i] = stones[i] + pre_sum[i-1];\n         } \n         return solve(stones, 0, n - 1, pre_sum);\n    }\n};
['Recursion', 'Memoization', 'C', 'Prefix Sum']