C++ || EXPLAINATION|| with Comments||
Approach-\n\nTake the sum of all positive values in nums, it will be maximum sum of any subsequence possible.\nMake all the elements of nums positive (Reason- L
**Approach**-\n\nTake the sum of all positive values in nums, it will be maximum sum of any subsequence possible.\nMake all the elements of nums positive (Reason- Later we will include or exclude the nums[i] in sum,\n**Case1**- If nums[i] was negative, if we subtract it from sum, it will be same as including it into subsequence and if we add/consider it to sum, it will be same as excluding it from subsequence.\n**Case2** - If nums[i] was positive, if we subtract it from sum, it will be same as excluding it from subsequence and if we add/consider it to sum, it will be same as including it into subsequence.\n\n\nSort the nums vector and create a priority_queue of type pair (to insert current sum and index).\nInsert the {sum-nums[0],0} into the priority_queue.\nNow while we didn\'t get kth highest sum of subsequence, do the following-\ntake the top of priority queue, if the ind+1 < n , then either include the ind+1 and ind value or exclude ind+1 value ( ind value is already excluded) .....\nIt will same as taking subsequences.\n```\n#define ll long long\nclass Solution {\npublic:\n    long long kSum(vector<int>& nums, int k) {\n        \n\t\tll sum=0,n=nums.size();\n        vector<ll> ans;  // vector to store first k maximum subsequence sum\n        for(ll i=0;i<nums.size();i++)\n        {\n            if(nums[i]>0)\n                sum+=nums[i]; // find the maximum possible sum\n            nums[i]=abs(nums[i]); // make all values of nums >=0\n\t\t\t\n        }\n        ans.push_back(sum); // push the highest possible sum\n        priority_queue<pair<ll,ll>> pq;  // priority queue to store the pair of sum and index, which denotes maximum sum if the current index value is excluded.\n        sort(nums.begin(),nums.end()); // sort the nums so that we include and exclude minimum value first to get highest subsequence values \n        pq.push({sum-nums[0],0}); // push sum-nums[0], 0 ....which denotes max subsequence sum when index 0 is excluded.\n\t\t// while we don\'t get the kth highest subsequence sum do the operation\n        while(ans.size()<k)\n        {\n            auto [sum,ind]=pq.top();\n            pq.pop();\n            if(ind+1<n)\n            {\n\t\t\t\n                pq.push({sum+nums[ind]-nums[ind+1],ind+1}); // if next index is possible, this case considers if we take the previous index and exclude the latest one i.e. ind+1\n                pq.push({sum-nums[ind+1],ind+1}); // if next is possible, this case considers, if we exclude both previous index as well as latest possible index i.e. ind+1\n            }\n            ans.push_back(sum);\t\t\t//push the next highest subsequence sum\n        }\n        return ans.back();            \n    }\n};\n```
[]