Greedy Delta | Sorting | Python
Complexity\n- Time complexity: O(nlogn)\n\n- Space complexity: O(n)\n\n# Code\n\nclass Solution:\n    def maximumValueSum(self, nums: List[int], k: int, edges: 
# Complexity\n- Time complexity: O(nlogn)\n\n- Space complexity: O(n)\n\n# Code\n```\nclass Solution:\n    def maximumValueSum(self, nums: List[int], k: int, edges: List[List[int]]) -> int:\n        delta = [(num^k)-num for num in nums]\n        delta.sort(reverse=True)\n        ans = sum(nums)\n\n        for i in range(0,len(nums)-1,2):\n            path = delta[i]+delta[i+1]\n            if path<=0:\n                break\n            ans+=path\n\n        return ans\n```
['Array', 'Greedy', 'Bit Manipulation', 'Tree', 'Sorting', 'Python', 'Python3']