Solved with for loop and a hashmap only
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:\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 temp[] = new int[nums.length];\n        for (int i =0 ;i<nums.length;i++){ temp[i]=nums[i];}\n        int res[] = new int[k];\n        Arrays.sort(temp);\n        HashMap<Integer, Integer> hm = new HashMap<>();\n\n        for (int i = temp.length - 1; i>=nums.length-k ; i--) {\n            if (hm.containsKey(temp[i])) {\n                hm.put(temp[i], hm.get(temp[i]) + 1);\n            } else {\n                hm.put(temp[i], 1);\n            }\n        }\n\n        int j = 0;\n        for (int i = 0; i < nums.length; i++) {\n            if (j == k) {\n                break;\n            }\n            if (hm.containsKey(nums[i])) {\n                if (hm.get(nums[i]) == 1) {\n                    hm.remove(nums[i]);\n                } else {\n                    hm.put(nums[i], hm.get(nums[i]) - 1);\n                }\n                res[j] = nums[i];\n                j++;\n            }\n        }\n        return res;\n    }\n}\n```
['Java']