Python | 4 Lines | Heapq | O(N + KlogN)
\nimport heapq\nclass Solution:\n    def largestSumAfterKNegations(self, A: List[int], K: int) -> int:\n        heapq.heapify(A)\n        for _ in range(K): \n 
```\nimport heapq\nclass Solution:\n    def largestSumAfterKNegations(self, A: List[int], K: int) -> int:\n        heapq.heapify(A)\n        for _ in range(K): \n            heapq.heapreplace(A, -A[0])\n        return sum(A)\n```
['Heap (Priority Queue)', 'Python', 'Python3']