JAVA || Easy || Priority Queue
\nclass Solution {\n    public int largestSumAfterKNegations(int[] nums, int k) {\n        PriorityQueue<Integer> q=new PriorityQueue<>();\n        for(int n:nu
```\nclass Solution {\n    public int largestSumAfterKNegations(int[] nums, int k) {\n        PriorityQueue<Integer> q=new PriorityQueue<>();\n        for(int n:nums){\n            q.add(n);\n        }\n        while(k>0)\n        {\n            int val=q.poll();\n            q.add(-val);\n            k--;\n        }\n        int sum=0;\n        while(!q.isEmpty())\n        {\n            sum+=q.poll();\n        }\n        return sum;\n    }\n}\n```
['Java']