0ms !!!! Lowest Complexity and Easy to Understand
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```\nimport java.util.*;\n\nclass Solution {\n    public int[] frequencySort(int[] nums) {\n        Map<Integer, Integer> frequencyMap = new HashMap<>();\n        for (int num : nums) {\n            frequencyMap.put(num, frequencyMap.getOrDefault(num, 0) + 1);\n        }\n\n        List<Integer> numList = new ArrayList<>();\n        for (int num : nums) {\n            numList.add(num);\n        }\n\n        Collections.sort(numList, (a, b) -> {\n            int freqA = frequencyMap.get(a);\n            int freqB = frequencyMap.get(b);\n            if (freqA != freqB) {\n                return Integer.compare(freqA, freqB);\n            } else {\n                return Integer.compare(b, a);\n            }\n        });\n\n        for (int i = 0; i < nums.length; i++) {\n            nums[i] = numList.get(i);\n        }\n\n        return nums;\n    }\n}\n\n```
['Java']