class Solution {
public:
static map<int,int> aaa;
static bool cmp(int a,int b) {
if(aaa[a]==aaa[b])
return a>b;
return aaa[a]<aaa[b];
}
vector<int> frequencySort(vector<int>& nums) {
for(int i=0;i<nums.size();i++)
aaa[nums[i]]++;
sort(nums.begin(),nums.end(),cmp);
return nums;
}
};
i dont know whats wrong. its looks like have no problem.the map:aaa cant be used int the function cmp. the debug is:
ld.lld: error: undefined symbol: Solution::aaa
clang-11: error: linker command failed with exit code 1 (use -v to see invocation)