1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
class Solution {
public:
    int minimumRounds(vector<int>& tasks) {
        // sort(tasks.begin(), tasks.end());
        map<intint> mp;
        for(auto v : tasks) mp[v]++;
        int ans = 0;
        
        for(auto &[k, v]: mp){
            if(v == 1return -1;
            else{
                if(v % 3 == 0) ans += v/3;
                else if(v % 3 == 1) ans += v/3 + 1;
                else ans += v/3 + 1;
            }
        }
        return ans;
    }
};
cs