✅✅understandable solution in java
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 {\n    public long maximumValueSum(int[] nums, int k, int[][] edges) {\n        long[][] memo = new long[nums.length][2];\n        for (long[] row : memo) {\n            Arrays.fill(row, -1);\n        }\n        return maxSumOfNodes(0, 1, nums, k, memo);\n    }\n\n    private long maxSumOfNodes(int index, int isEven, int[] nums, int k,\n            long[][] memo) {\n        if (index == nums.length) {\n            // If the operation is performed on an odd number of elements return\n            // INT_MIN\n            return isEven == 1 ? 0 : Integer.MIN_VALUE;\n        }\n        if (memo[index][isEven] != -1) {\n            return memo[index][isEven];\n        }\n        // No operation performed on the element\n        long noXorDone = nums[index] + maxSumOfNodes(index + 1, isEven, nums, k, memo);\n        // XOR operation is performed on the element\n        long xorDone = (nums[index] ^ k) +\n                maxSumOfNodes(index + 1, isEven ^ 1, nums, k, memo);\n\n        // Memoize and return the result\n        return memo[index][isEven] = Math.max(xorDone, noXorDone);\n    }\n}\n```
['Java']