HashMap Solution
 # Intuition  \n\n\n# Approach : Using HashMap and Sorting\n\n\n# Complexity\n- Time complexity: O(nlogn)\n\n\n- Space complexity: O(n)\n\n\n# Code\n\nclass Sol
<!-- # Intuition -->\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach : Using HashMap and Sorting\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity: O(nlogn)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(n)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public int[] frequencySort(int[] nums) {\n        HashMap<Integer, Integer> map = new HashMap<>();\n        List<Integer> list = new ArrayList<>();\n        for(int n : nums) {\n            list.add(n);\n            map.put(n, map.getOrDefault(n, 0) + 1);\n        }\n        Collections.sort(list, (a, b) ->\n        (map.get(a) == map.get(b)) ? b-a : map.get(a)-map.get(b));\n        return list.stream().mapToInt(Integer::intValue).toArray();\n    }\n}\n```
['Array', 'Hash Table', 'Sorting', 'Java']