6 lines solution using sort.
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n1. use index to record the index of nums.\n2. sort index by nums[o2] - nu
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n1. use index to record the index of nums.\n2. sort index by nums[o2] - nums[o1].\n3. sort index.range: 0 --> k.\n4. fill result and return.\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public int[] maxSubsequence(int[] nums, int k) {\n        int[] result = new int[k];;\n        int[] index = IntStream.range(0, nums.length).boxed().sorted((o1, o2) -> nums[o2] - nums[o1])\n                .mapToInt(Integer::intValue).toArray();\n\n        Arrays.sort(index, 0, k);\n\n        for (int i = 0; i < k; i++)\n            result[i] = nums[index[i]];\n\n        return result;\n    }\n}\n```
['Java']