C++ Solution using Priority_Queue || With Comments
\nclass Solution {\npublic:\n    long long kSum(vector<int>& nums, int k) {\n        \n        long long totSum = 0;\n        \n        // calculate sum of all 
```\nclass Solution {\npublic:\n    long long kSum(vector<int>& nums, int k) {\n        \n        long long totSum = 0;\n        \n        // calculate sum of all positive numbers, i.e maxSubseqSum (2^nth sum)\n        for(auto &num : nums)\n        {\n            if(num > 0)\n                totSum += num;\n            \n            num = abs(num);\n        }\n        \n        // sort ascending order\n        sort(nums.begin(), nums.end());\n        \n        // maintain {subseqSum, index which we taken to reduce the sum}\n        priority_queue<pair<long long, int>> pq;\n        \n        // push totSum - first num, num pos is 0\n        pq.push({totSum - nums[0], 0});\n        \n        long long res = totSum, n = nums.size();\n        \n        while(--k)\n        {\n            auto cur = pq.top(); pq.pop();\n            \n            res = cur.first;\n            \n            int idx = cur.second;\n            \n            if(idx < n - 1)\n            {\n                // generate next possible sum\n                \n                // pick curIdx and try with the next idx\n                pq.push({res + nums[idx] - nums[idx + 1], idx + 1});\n                \n                // notPick curIdx and try with the next idx\n                pq.push({res - nums[idx + 1], idx + 1});\n            }\n        }\n        \n        return res;\n    }\n};\n```\n\nLogic from this Post: https://leetcode.com/problems/find-the-k-sum-of-an-array/discuss/2456676/Java-Solution
['C', 'Heap (Priority Queue)']