✅✔️Easy to understand C++ Solution || min Heap || 92% Beat✈️✈️✈️✈️✈️
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    vector<int> maxSubsequence(vector<int>& nums, int k) {\n        int n = nums.size();\n        vector<pair<int,int>>vp;\n        for(int i=0; i<n; i++){\n            vp.push_back({nums[i],i});\n        }\n        priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>>pq;\n        for(auto p:vp){\n            pq.push(p);\n            if(pq.size() > k) pq.pop();\n        }\n        vector<pair<int,int>>temp;\n        while(!pq.empty()){\n            temp.push_back({pq.top().second,pq.top().first});pq.pop();\n        }\n        sort(temp.begin(),temp.end());\n        vector<int>ans;\n        for(auto p:temp){\n            ans.push_back(p.second);\n        }\n        return ans;\n    }\n};\n```
['Array', 'Heap (Priority Queue)', 'C++']