C++ Sort by frequency
See my latest update in repo LeetCode\n\n## Solution 1. Sort\n\ncpp\n// OJ: https://leetcode.com/contest/biweekly-contest-38/problems/sort-array-by-increasing-f
See my latest update in repo [LeetCode](https://github.com/lzl124631x/LeetCode)\n\n## Solution 1. Sort\n\n```cpp\n// OJ: https://leetcode.com/contest/biweekly-contest-38/problems/sort-array-by-increasing-frequency/\n// Author: github.com/lzl124631x\n// Time: O(NlogN)\n// Space: O(N)\nclass Solution {\npublic:\n    vector<int> frequencySort(vector<int>& A) {\n        unordered_map<int, int> cnt;\n        for (int n : A) cnt[n]++;\n        sort(begin(A), end(A), [&](int a, int b) { return cnt[a] != cnt[b] ? cnt[a] < cnt[b] : a > b; });\n        return A;\n    }\n};\n```
[]