Easy sol^n
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\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 top_down(vector<int>& nums,int i,int j,int sum,unordered_map<int,int>&mapping,vector<vector<vector<int>>>&dp)\n     {\n        if(i>=j)\n        {\n           return 0;\n        }\n        if((sum!=-1)&&dp[mapping[sum]][i][j]!=-1)\n        return dp[mapping[sum]][i][j];\n        if(sum==-1)\n        {\n            int val1=0;\n            int val2=0;\n            int val3=0;\n          if(i+1<nums.size())\n           val1=1+top_down(nums,i+2,j,nums[i]+nums[i+1],mapping,dp);\n          if(j-1>=0)\n           val2=1+top_down(nums,i,j-2,nums[j]+nums[j-1],mapping,dp);\n           val3=1+top_down(nums,i+1,j-1,nums[i]+nums[j],mapping,dp);\n          return max(val1,max(val2,val3));\n        }\n        else\n        {\n            int val1=0;\n            int val2=0;\n            int val3=0;\n            if((i+1<nums.size())&&((nums[i]+nums[i+1])==sum))\n            {\n                val1=1+top_down(nums,i+2,j,nums[i]+nums[i+1],mapping,dp);\n            }\n            if((j-1>=0)&&((nums[j]+nums[j-1])==sum))\n            {\n                val2=1+top_down(nums,i,j-2,nums[j]+nums[j-1],mapping,dp);\n            }\n            if((nums[i]+nums[j])==sum)\n            val3=1+top_down(nums,i+1,j-1,nums[i]+nums[j],mapping,dp);\n            dp[mapping[sum]][i][j]=max(val1,max(val2,val3));\n            return dp[mapping[sum]][i][j];\n        }\n     }\n    int maxOperations(vector<int>& nums) {\n         unordered_map<int,int>mapping;\n         mapping[nums[0]+nums[1]]=0;\n         mapping[nums[nums.size()-1]+nums[nums.size()-2]]=1;\n         mapping[nums[0]+nums[nums.size()-1]]=2;\n         vector<vector<vector<int>>>dp(3,vector<vector<int>>(nums.size()+1,vector<int>(nums.size()+1,-1)));\n         return top_down(nums,0,nums.size()-1,-1,mapping,dp); \n    }\n};\n```
['Array', 'Dynamic Programming', 'Memoization', 'C++']