C++ - Greedy Using Priority Queue - Easy
\nclass Solution {\npublic:\n    int largestSumAfterKNegations(vector<int>& nums, int k) \n    {\n        int res=0;\n        priority_queue<int, vector<int>, g
```\nclass Solution {\npublic:\n    int largestSumAfterKNegations(vector<int>& nums, int k) \n    {\n        int res=0;\n        priority_queue<int, vector<int>, greater<int>> pq;\n        for(int i:nums)\n            pq.push(i);\n        while(k--)\n        {\n            int x=pq.top(); pq.pop();\n            pq.push(x * -1);\n        }\n        while(!pq.empty())\n        {\n            res += pq.top();\n            pq.pop();\n        }\n        return res;\n    }\n};\n```
['Greedy', 'C', 'Heap (Priority Queue)']