5 line code in  c++
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \nsorting\n\n# Complexity
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nsorting\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\nklog(n)\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\nO(1)\n\n# Code\n```\nclass Solution {\npublic:\n    int largestSumAfterKNegations(vector<int>& nums, int k) {\n        sort(begin(nums),end(nums));\n        int sum=0;\n        while(k>0)\n        {\n                nums[0]=-nums[0];\n                sort(begin(nums),end(nums));\n                 k--;\n        }\n         for(int i=0;i<nums.size();i++)\n        {\n            sum+=nums[i];\n        }\n        return sum;\n    }\n};\n```
['Sorting', 'C++']