💯🔥✅ Simple JS/TS solution
\n\n# Code\n\nfunction maximumValueSum(nums: number[], k: number, edges: number[][]): number {\n    const delta = nums.map((n) => (n ^ k) - n).sort((a, b) => b 
\n\n# Code\n```\nfunction maximumValueSum(nums: number[], k: number, edges: number[][]): number {\n    const delta = nums.map((n) => (n ^ k) - n).sort((a, b) => b - a)\n\tlet res = nums.reduce((acc, curr) => acc + curr, 0)\n\n\tfor (let i = 0; i < nums.length; i += 2) {\n\t\tif (i === nums.length - 1) break\n\t\t\n        const sum = delta[i] + delta[i + 1]\n\n\t\tif (sum > 0) res += sum\n\t}\n\n\treturn res\n};\n```
['Array', 'Greedy', 'Bit Manipulation', 'Tree', 'Sorting', 'TypeScript', 'JavaScript']