Skip to content

Commit 70fa15a

Browse files
committed
Add C++ solution of problem #3223
1 parent 6215243 commit 70fa15a

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

3223/solution.cpp

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
class Solution {
2+
public:
3+
int minimumLength(string s) {
4+
vector<int> cnt(26);
5+
for(char c : s)
6+
cnt[c - 'a']++;
7+
8+
int ans = 0;
9+
for(int e : cnt) {
10+
if(e == 0)
11+
continue;
12+
13+
ans += (e % 2 == 0) ? 2 : 1;
14+
}
15+
return ans;
16+
}
17+
};

0 commit comments

Comments
 (0)