C++ Tabulation Clean Code
\n    int stoneGameVII(vector<int>& stones) {\n      int n = stones.size();\n      vector<int> prefixSum(n+1,0);\n      for (int i = 1; i <= n; i++)\n        pr
```\n    int stoneGameVII(vector<int>& stones) {\n      int n = stones.size();\n      vector<int> prefixSum(n+1,0);\n      for (int i = 1; i <= n; i++)\n        prefixSum[i] = prefixSum[i-1] + stones[i-1];\n\n      vector<vector<int>> dp(n, vector<int>(n,0));\n\n      for (int gap = 1 ; gap < n ; gap++ ){\n        for (int i = 0, j = gap; j < n ; j++, i++){\n          int start =  prefixSum[j + 1] - prefixSum[i+1];\n          int end  = prefixSum[j] - prefixSum[i];\n          \n          dp[i][j] = max( start - dp[i+1][j] , end - dp[i][j-1]);  \n        }\n      }\n      return dp[0][n-1];      \n    }\n```
['Dynamic Programming', 'C']