Skip to content

Commit

Permalink
Time: 558 ms (33.27%), Space: 103.6 MB (89.36%) - LeetHub
Browse files Browse the repository at this point in the history
  • Loading branch information
Dipendra-Raghav committed Jan 4, 2023
1 parent 6c637b1 commit 40d1953
Showing 1 changed file with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
class Solution {
public:
int minimumRounds(vector<int>& tasks) {
unordered_map<int, int> m;
for(int i=0;i<tasks.size();i++)
{
m[tasks[i]]++;
}
int cnt=0;

for(auto it: m)
{
if(it.second==1)return -1;
if(it.second%3==0)cnt+=it.second/3;
else
cnt+=it.second/3+1;
}
return cnt;

}
};

0 comments on commit 40d1953

Please sign in to comment.