Easiest Solution Using Java
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:\nO(n)\n\n- Space complexity:\nO(n)\n\n# Code\n```\nclass Solution {\n    public int[] maxSubsequence(int[] nums, int k) {\n        \n    PriorityQueue<int[]>pq=new PriorityQueue<>((a, b) -> b[0]-a[0]);\n\n    for(int i=0;i<nums.length;i++){\n        \n        pq.add(new int[]{nums[i],i});\n    \n    }\n\n    int[]check=new int[k];\n    \n    int i=0;\n    int n=k;\n    while(n>0){\n    int m[]=pq.poll();\n    check[i++]=m[1];\n    n--;\n    }\n\n    Arrays.sort(check);\n\n    int []ans=new int[k];\n\n    for(int j=0;j<k;j++){\n        ans[j]=nums[check[j]];\n    }\n\n    return ans;\n\n    }\n}\n```
['Sorting', 'Heap (Priority Queue)', 'Java']