C++ Line-By-Line Explanation Using Priority Queue and Sorting
\nclass Solution {\npublic:\n    vector<int> maxSubsequence(vector<int>& nums, int k) {\n        vector<int>v(k,0);  //vector container for stroring solution\n 
```\nclass Solution {\npublic:\n    vector<int> maxSubsequence(vector<int>& nums, int k) {\n        vector<int>v(k,0);  //vector container for stroring solution\n        \n        priority_queue<pair<int,int>>pq;  //Priority Queue for filtering top K numbers along with index\n        for(int i=0;i<nums.size();i++){   //inserting numbers into pq with as{number,index}\n            pq.push({nums[i],i});\n        }\n        for(int i=0;i<k;i++){\n           v[i]=pq.top().second;   //selecting index of top k numbers\n            pq.pop();\n        }\n        sort(v.begin(),v.end());  //sorting based on index to maintain original order of numbers\n         for(int i=0;i<k;i++){\n           v[i]=nums[v[i]];      //retieving numbers based on their index\n        }\n        return v;   //returning the solution\n    }\n};\n```
['C', 'Sorting', 'Heap (Priority Queue)']