Simple solution with python (40ms)
\nclass Solution:\n    def largestSumAfterKNegations(self, A: List[int], K: int) -> int:\n        A.sort()\n        i = 0\n        while K > 0 and A[i] < 0:\n  
```\nclass Solution:\n    def largestSumAfterKNegations(self, A: List[int], K: int) -> int:\n        A.sort()\n        i = 0\n        while K > 0 and A[i] < 0:\n            A[i] *= -1\n            i += 1\n            K -= 1\n        if K % 2 == 0:\n            return sum(A)\n        else:\n            return sum(A) - 2 * min(A[i],A[i-1])\n```
['Python', 'Python3']