JAVA SIMPLE SOLUTION FASTER THAN 95%
JAVA CODE IS:\n#    \n\nclass Solution {\n    public int[] frequencySort(int[] nums) {\n      Map<Integer,Integer>map=new HashMap<>();\n        for(int val : nu
JAVA CODE IS:\n#    \n```\nclass Solution {\n    public int[] frequencySort(int[] nums) {\n      Map<Integer,Integer>map=new HashMap<>();\n        for(int val : nums)\n            map.put(val,map.getOrDefault(val,0)+1);\n        PriorityQueue<int[]>pq=new PriorityQueue<>((a,b)->b[1]!=a[1] ? a[1]-b[1] : b[0]-a[0]);\n        for(Map.Entry<Integer,Integer>m : map.entrySet())\n            pq.add(new int[]{m.getKey(),m.getValue()});\n        int i=0;\n        while(!pq.isEmpty()){\n            int a[]=pq.poll();\n            while(a[1]-->0)\n                nums[i++]=a[0];\n        }\n        return nums;\n    }\n}\n```\nTime : O(nlogn)\nSpace : O(n)\n***PLEASE,UPVOTE IF THIS IS HELPFUL***
[]