take, Not take || Easy✅ || Beats 100%🎯|| C++
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: O(n*2)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(n*2)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int n;\n    vector<vector<long long>>dp;\n\n    long long solve(int i,int j,vector<int>&nums,int k)\n    {\n        if(i==n)\n        return j==0 ? 0 : -INT_MAX;\n\n        if(dp[i][j]!=-1)\n        return dp[i][j];\n\n        long long notake = nums[i] + solve(i+1,j,nums,k);\n        long long take = (nums[i]^k) + solve(i+1,(j+1)%2,nums,k);\n    \n        return dp[i][j]= max(take,notake);\n    }\n    long long maximumValueSum(vector<int>& nums, int k, vector<vector<int>>& edges) {\n\n        n=nums.size();\n        dp.resize(n,vector<long long>(2,-1));\n        return solve(0,0,nums,k);\n    }\n};\n```
['Dynamic Programming', 'Recursion', 'C++']