C# Simple DP
\npublic class Solution\n{\n    public int StoneGameVII(int[] stones)\n    {\n        int sum = stones.Sum();\n        return Max(stones, 0, stones.Length - 1, 
```\npublic class Solution\n{\n    public int StoneGameVII(int[] stones)\n    {\n        int sum = stones.Sum();\n        return Max(stones, 0, stones.Length - 1, sum, new int[stones.Length, stones.Length]);\n    }\n\n    private int Max(int[] stones, int i, int j, int sum, int[,] memo)\n    {\n        if (i == j) return 0;\n        if (memo[i, j] > 0) return memo[i, j];\n        return memo[i, j] = Math.Max(\n            sum - stones[i] - Max(stones, i + 1, j, sum - stones[i], memo), \n            sum - stones[j] - Max(stones, i, j - 1, sum - stones[j], memo));\n    }\n}\n```
[]