C++ using Map || With Explanation...
\nclass Solution {\npublic:\n  static bool comp(pair<int,int>p,pair<int,int>q)\n      //first column stores frequency i.e duplicates and second column stores va
```\nclass Solution {\npublic:\n  static bool comp(pair<int,int>p,pair<int,int>q)\n      //first column stores frequency i.e duplicates and second column stores value\n  {//if the duplicates are equal then we will return by greater value first...\n  if(p.first==q.first)\n  {\n  return p.second>q.second;\n  }\n      ///else we will return as per frequency.\n  return p.first<q.first;\n  }\n        vector<int> frequencySort(vector<int>& nums) {\n            \n        map<int,int>sk; \n        for(int i=0;i<nums.size();i++){ ///inserting value and its duplicate in map...\n            sk[nums[i]]++;   \n        }\n        vector<int>ans;\n        vector<pair<int,int>>temp; //creating pair so that we can sort\n        for(auto i:sk){\n            temp.push_back({i.second,i.first});  ///now adding duplicate in first and value in second column...\n        }\n        sort(temp.begin(),temp.end(),comp); ///sorting by function...\n        for(auto z:temp){\n            int a=z.first;\n            int b=z.second;\n            for(int j=0;j<a;j++){\n                ans.push_back(b);\n            }\n        }\n        \n        return ans;\n    }\n};\n```
['C']