8000 Create 3223. Minimum Length of String After Operations · stutipandey20/Leetcode-Challenge@c478889 · GitHub
[go: up one dir, main page]

Skip to content

Commit c478889

Browse files
authored
Create 3223. Minimum Length of String After Operations
1 parent 56766e2 commit c478889

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
class Solution {
2+
public int minimumLength(String s) {
3+
char[] ch = s.toCharArray();
4+
int[] count = new int[26];
5+
for(char c:ch){
6+
count[c-'a']++;
7+
}
8+
int result = 0;
9+
for(int ct: count){
10+
if(ct>0) result+=(ct%2==0?2:1);
11+
}
12+
return result;
13+
}
14+
}

0 commit comments

Comments
 (0)
0