You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class Solution {
public:
int maxNumberOfBalloons(string text) {
int res = INT_MAX;
string balloon = "balloon";
unordered_map<char, int> charCnt;
for (char c : text) ++charCnt[c];
for (char c : balloon) {
if (c == 'l' || c == 'o') res = min(res, charCnt[c] / 2);
else res = min(res, charCnt[c]);
}
return res;
}
};
Activity
[-][LeetCode] 1189. Missing Problem[/-][+][LeetCode] 1189. Maximum Number of Balloons[/+]