C++ || Hashmap || Simple + Optimized
\n# Code\n\nclass Solution {\npublic:\n    vector<int> frequencySort(vector<int>& nums) {\n        unordered_map<int, int> mp;\n        for(auto i : nums) { // 
\n# Code\n```\nclass Solution {\npublic:\n    vector<int> frequencySort(vector<int>& nums) {\n        unordered_map<int, int> mp;\n        for(auto i : nums) { // store cnt of every num\n            mp[i]++;\n        }\n        sort(nums.begin(), nums.end(), [&](int a, int b) {\n            if(mp[a] == mp[b]) return a > b; // \u2193\n            else return mp[a] < mp[b]; // \u2191\n        });\n        return nums; \n    }\n};\n```
['Hash Table', 'C++']