leetcode

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

2244.cpp (327B)


      1 class Solution {
      2   public:
      3     int minimumRounds(vector<int> &tasks) {
      4         unordered_map<int, int> um;
      5         for (int t : tasks)
      6             um[t]++;
      7 
      8         int round = 0;
      9         for (auto [_, c] : um) {
     10             if (c == 1) return -1;
     11             round += (c - 1) / 3 + 1;
     12         }
     13         return round;
     14     }
     15 };