Stone Game VII Time Limit Exceeded even after using memorization
This is the Solution i made using memorization. But still Iam getting Time Limit Error. Can anyone suggest Where am i Doing wrong?\n\n\n int helper(int left,int
This is the Solution i made using memorization. But still Iam getting Time Limit Error. Can anyone suggest Where am i Doing wrong?\n\n```\n int helper(int left,int right,int sum,vector<int> stones,vector<vector<int>> &hm)\n {\n        if(hm[left][right]!=-1)return hm[left][right];\n        if(left==right)return stones[left];\n        int left_res = helper(left+1,right,sum-stones[left],stones,hm);   // selecting left most stone\n        int right_res = helper(left,right-1,sum-stones[right],stones,hm); // selectin right most stone\n        int sol = sum-max(left_res,right_res);\n        hm[left][right]=sol;\n        return (sol);\n    }\n    int stoneGameVII(vector<int>& stones) {\n        int sum = 0;\n        int size = stones.size();\n        vector<vector<int>> hm(size,vector<int>(size,-1));\n        for(int i:stones)\n            sum+=i;\n        return max(helper(1,size-1,sum-stones[0],stones,hm),helper(0,size-2,sum-stones[size-1],stones,hm));\n    }\n```
[]