Heapq python
\nimport heapq\nclass Solution(object):\n    def largestSumAfterKNegations(self, A, K):\n        heapq.heapify(A)\n        while K:\n            heapq.heaprepla
```\nimport heapq\nclass Solution(object):\n    def largestSumAfterKNegations(self, A, K):\n        heapq.heapify(A)\n        while K:\n            heapq.heapreplace(A, -A[0])\n            K -= 1\n        return sum(A)\n```
[]