Simple C++ Solution || Sorting ||  TC : O(n * lg(n)) || SC : O(n)
We can simply find the solution by simply performing the following steps :-\nStep -1 -> First copy the given array into another array of pair along with index.\
We can simply find the solution by simply performing the following steps :-\nStep -1 -> First copy the given array into another array of pair along with index.\nStep -2 -> Sort them in decreasing order (It will be sorted wrt value).\nStep -3 -> Traverse the first k values and mark their indexes in a boolean **taken** array.\nStep -4 -> Now traverse the original array again and keep the elements marked in previous step into our **result** array sequentially. \n\n```\nclass Solution {\npublic:\n    vector<int> maxSubsequence(vector<int>& nums, int k) {\n        int n = nums.size();\n        vector<pair<int, int>> numsWithIndex(n);\n        vector<bool> taken(n, false);\n        vector<int> result;\n        \n\t\t//Step 1\n        for(int i=0;i<n;i++) numsWithIndex[i] = {nums[i], i};\n\t\t\n\t\t//Step 2\n        sort(numsWithIndex.begin(), numsWithIndex.end(), greater<pair<int, int>>());\n        \n\t\t//Step 3\n        for(int i=0;i<k;i++) taken[numsWithIndex[i].second] = true;\n        \n\t\t//Step 4\n        for(int i=0;i<n;i++) {\n            if(taken[i]) result.push_back(nums[i]);\n        }\n        return result;\n    }\n};\n```
['C', 'Sorting', 'C++']