Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 8599b0a

Browse files
solved leetcode daily challenge, Maximum Number of Balloons
See: Why: How: Tags:
1 parent 141c701 commit 8599b0a

File tree

1 file changed

+60
-0
lines changed
  • LeetCode/Maximum_Number_of_Balloons

1 file changed

+60
-0
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#include <bits/stdc++.h>
2+
#include <gtest/gtest.h>
3+
using namespace std;
4+
5+
6+
//// START
7+
/*
8+
## Maximum Number of Balloons
9+
10+
*/
11+
12+
class Solution {
13+
public:
14+
int maxNumberOfBalloons(string text) {
15+
vector<int> nums(26);
16+
for (char c : text){
17+
nums[c - 'a']++;
18+
}
19+
int count = INT_MAX;
20+
count = min(count,nums['b'-'a']);
21+
count = min(count,nums['a'-'a']);
22+
count = min(count,nums['l'-'a']/2);
23+
count = min(count,nums['o'-'a']/2);
24+
count = min(count,nums['n'-'a']);
25+
return count;
26+
27+
}
28+
};
29+
30+
31+
//// END
32+
struct T{
33+
34+
};
35+
36+
TEST(Solution,test){
37+
T ts[] = {
38+
{
39+
40+
},
41+
{
42+
43+
},
44+
45+
};
46+
47+
48+
for (T t : ts){
49+
Solution solution;
50+
51+
}
52+
}
53+
54+
int main() {
55+
testing::InitGoogleTest();
56+
57+
return RUN_ALL_TESTS();
58+
}
59+
60+

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /