C++ Simple Min Heap Solution
\ntypedef pair<int, int> pi;\nclass Solution {\npublic:\n    vector<int> maxSubsequence(vector<int>& nums, int k) {\n        vector<int>ans;\n        int n=nums
```\ntypedef pair<int, int> pi;\nclass Solution {\npublic:\n    vector<int> maxSubsequence(vector<int>& nums, int k) {\n        vector<int>ans;\n        int n=nums.size();\n        if(n==k)return nums;\n        \n         priority_queue<pi, vector<pi>, greater<pi> > pq;\n        for(int i=0;i<n;i++){    // sorting by value  (storing top k greater  value)\n            pq.push({nums[i],i});\n            if(pq.size()>k)pq.pop();\n        }\n        priority_queue<pi, vector<pi>, greater<pi> > sort;\n        while(!pq.empty()){        //sorting by index for subsequences\n            sort.push({pq.top().second,pq.top().first});\n            pq.pop();\n        }\n        while(!sort.empty()){     //pushing in ans\n            ans.push_back(sort.top().second);\n            sort.pop();\n        }\n            \n        \n        return ans;    \n        \n    }\n};\n```
['C', 'Heap (Priority Queue)', 'C++']