Simple Solution Using C++
\n\n# Code\n\nclass Solution {\npublic:\n    vector<int> maxSubsequence(vector<int>& nums, int k) {\n        if(nums.size()==k) return nums;\n        priority_q
\n\n# Code\n```\nclass Solution {\npublic:\n    vector<int> maxSubsequence(vector<int>& nums, int k) {\n        if(nums.size()==k) return nums;\n        priority_queue<pair<int,int>>q;\n        int n=nums.size();\n        for(int i=0;i<n;i++) q.push({nums[i],i});\n        vector<pair<int,int>>v;\n        while(k--){\n            v.push_back({q.top().second,q.top().first});\n            q.pop();\n        }\n        sort(v.begin(),v.end());\n        vector<int>ans;\n        for(auto x:v) ans.push_back(x.second);\n        return ans;\n\n    }\n};\n```
['C++']