🔥1 Linear python Solution 99.82%Beats🔥
Intuition\n Describe your first thoughts on how to solve this problem. we have to sort the array and take the last k elements.\n\n# Approach\n Describe your app
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->we have to sort the array and take the last k elements.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nReturn them according to their indexes in ascending way\nsort indexes using Lambda founction.\n.............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................//////////Please Upvote Guys/////\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\nO(n*k)\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\nO(n)\n# Code\n```\nclass Solution:\n    def maxSubsequence(self, nums: List[int], k: int) -> List[int]:\n        return [i[0] for i in sorted(sorted([[j,i] for i,j in enumerate(nums)])[-k:],key=lambda g:g[1])]\n```
['Python3']