Java || MinHeap || Simple Greedy Approach
\nclass Solution {\n    public int largestSumAfterKNegations(int[] A, int K) {\n        PriorityQueue<Integer> minHeap = new PriorityQueue<>();\n        \n     
```\nclass Solution {\n    public int largestSumAfterKNegations(int[] A, int K) {\n        PriorityQueue<Integer> minHeap = new PriorityQueue<>();\n        \n        for(int elem: A){\n            minHeap.add(elem);\n        }\n        \n        for(int i=0 ; i<K ; ++i){\n            int curr = minHeap.poll();\n            minHeap.add(-1*curr);\n        }\n        \n        int sum = 0;\n        while(!minHeap.isEmpty()){\n            sum += minHeap.poll();\n        }\n        \n        return sum;\n    }\n}\n```\n
['Greedy', 'Heap (Priority Queue)', 'Java']