Simple Recursion, there are 2 choices || Hindi Comments
Intuition\n Describe your first thoughts on how to solve this problem. \nGame theory ka yhi basics h ki apna max bnao aur saamne wle se expect kro ki vo tumhe w
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nGame theory ka yhi basics h ki apna max bnao aur saamne wle se expect kro ki vo tumhe worst ans laake dega, uske baad bs recursion h \n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int dp[1001][1001];\n    int solve(vector<int>&nums,int l,int r,int sum)\n    {\n        if(l>r)\n        {\n            return 0;\n        }\n        if(dp[l][r]!=-1)\n        {\n            return dp[l][r];\n        }\n        //phle se lia\n        int val1=sum-nums[l]-solve(nums,l+1,r,sum-nums[l]);\n        //dusre se lia\n        int val2=sum-nums[r]-solve(nums,l,r-1,sum-nums[r]);\n        //subtract islie qki bob ka score sub krna pdhega, baaki bachi hui array me kah diya bob ko ki apna max utha laa\n        return dp[l][r]=max(val1,val2);\n    }\n    int stoneGameVII(vector<int>& nums) {\n        memset(dp,-1,sizeof(dp));\n        int l=0;\n        int r=nums.size()-1;\n        int sum=accumulate(nums.begin(),nums.end(),0);\n        return solve(nums,l,r,sum);\n    }\n};\n```
['Dynamic Programming', 'Recursion', 'Memoization', 'Game Theory', 'C++']