leetcodeSolution to some Leetcode problems written in C++ |
git clone git://git.dimitrijedobrota.com/leetcode.git |
Log | Files | Refs | README | LICENSE |
2244.cpp (327B)
0 class Solution { 1 public: 2 int minimumRounds(vector<int> &tasks) { 3 unordered_map<int, int> um; 4 for (int t : tasks) 5 um[t]++; 6 7 int round = 0; 8 for (auto [_, c] : um) { 9 if (c == 1) return -1; 10 round += (c - 1) / 3 + 1; 11 } 12 return round; 13 } 14 };