C++| 100% faster| EASY TO UNDERSTAND | fast and efficient code using comparator function
Please upvote to motivate me in my quest of documenting all leetcode solutions. HAPPY CODING:)\nAny suggestions and improvements are always welcome\n```\nclass 
***Please upvote to motivate me in my quest of documenting all leetcode solutions. HAPPY CODING:)\nAny suggestions and improvements are always welcome***\n```\nclass Solution {\npublic:\n    bool static comp(pair<int,int> a,pair<int,int> b)\n    {\n        if(a.second==b.second)\n        return a>b;   \n        else\n        return a.second<b.second;\n    }\n    vector<int> frequencySort(vector<int>& nums) {\n         unordered_map<int,int> mp;\n         for(int i=0;i<nums.size();i++)\n         {\n             mp[nums[i]]++;\n         }\n         vector<pair<int,int> > vec;\n         for(auto pr:mp)\n         {\n             vec.push_back(pr);\n         }\n         sort(vec.begin(),vec.end(),comp);\n         \n vector<int> ans;\n    for(int i=0;i<vec.size();i++)\n    {\n     while(vec[i].second>0)\n     {\n         ans.push_back(vec[i].first);\n         vec[i].second--;\n     }\n    }\n        return ans;\n    }\n};
['C']