O(n) solution. 4ms runtime.
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: O(n)\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```\nimport java.util.Arrays;\n\nclass Solution {\n\n    public int[] maxSubsequence(int[] nums, int k) {\n\n        int[] res = new int[k];\n\n        for (int i=0; i<k; i++){\n            res[i] = i;\n        }\n\n        for (int i=k; i < nums.length; i++){\n\n            int tmp_min = Integer.MAX_VALUE;\n            int tmp_idx = -1;\n\n            for (int j=0; j<k; j++){\n                \n                if (nums[res[j]] < tmp_min){\n                    tmp_min = nums[res[j]];\n                    tmp_idx = j;\n                }\n\n            }\n\n            if (nums[i] > tmp_min){\n                res[tmp_idx] = i;\n            }    \n\n        }\n\n        Arrays.sort(res);\n        for (int i=0; i<k;i++){\n            res[i] = nums[res[i]];\n        }\n\n        return res;\n        \n    }\n}\n```
['Java']