A very simple java solution
\n    public int largestSumAfterKNegations(int[] A, int K) {\n        PriorityQueue<Integer> pq = new PriorityQueue<Integer>();\n        \n        for(int x: A)
```\n    public int largestSumAfterKNegations(int[] A, int K) {\n        PriorityQueue<Integer> pq = new PriorityQueue<Integer>();\n        \n        for(int x: A) pq.add(x);\n        while( K--  > 0) pq.add(-pq.poll());\n  \n        int sum  = 0;\n        for(int i = 0; i < A.length; i++){\n            sum += pq.poll();\n        }\n        return sum;\n    }\n```
[]