javascript Six Lines Only Method with explanation
Intuition\n##### we do not need list of agdes at all\nIt is easy to demonstrate that we can perform an operation between any nums[u] and nums[v] with multiple o
# Intuition\n##### we do not need list of `agdes` at all\nIt is easy to demonstrate that we can perform an operation between any `nums[u]` and `nums[v]` with multiple operations, even if there is no direct edge between them.\n##### calculate `(nums[u] ^ k) - nums[u]` for each number\nAfter calculations, we received an array with differences between numbers after operations. From this array we have to keep only an even number, only one (or none) of them can be negative for maximization or summing.\n\n\n\n# Code\n```\nvar maximumValueSum = (nums, k) =>\n    nums.reduce((x, y) => x + y) +\n    nums.map(v => (v ^ k) - v)\n        .sort((x, y) => y - x)\n        .map((v, i, a) => a[2 * i] + a[2 * i + 1])\n        .filter(v => v > 0)\n        .reduce((x, y) => x + y, 0);\n\n```\n\n##### please upvote, you motivate me to solve problems in original ways
['JavaScript']