C++ || Easy || Priority Queue
\nclass Solution {\npublic:\n    vector<int> maxSubsequence(vector<int>& nums, int k) {\n        \n       priority_queue<pair<int,int>,vector<pair<int,int>>,gre
```\nclass Solution {\npublic:\n    vector<int> maxSubsequence(vector<int>& nums, int k) {\n        \n       priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>>pq;\n        int n=nums.size();\n        int i;\n        for(i=0;i<n;i++)\n        {\n            pq.push({nums[i],i});\n            if(pq.size()>k)\n                pq.pop();\n        }\n        vector<pair<int,int>>ans;\n        while(!pq.empty())\n        {\n            auto x=pq.top();\n            pq.pop();\n            ans.push_back({x.second,x.first});\n        }\n        sort(ans.begin(),ans.end());\n        vector<int>res;\n        for(auto i:ans)\n            res.push_back(i.second);\n        \n        return res;\n    }\n};\n```
['C', 'Heap (Priority Queue)']