leetcode

Solution to some Leetcode problems written in C++
git clone git://git.dimitrijedobrota.com/leetcode.git
Log | Files | Refs | README | LICENSE

2610.cpp (381B)


0 class Solution { 1 public: 2 vector<vector<int>> findMatrix(const vector<int> &nums) { 3 int count[201] = {0}; 4 vector<vector<int>> res; 5 for (int n : nums) { 6 if (count[n] >= res.size()) 7 res.push_back({n}); 8 else 9 res[count[n]].push_back(n); 10 count[n]++; 11 } 12 return res; 13 } 14 };