We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7428ed3 commit 795ec4dCopy full SHA for 795ec4d
leetcode/daily/3223/sol.go
@@ -0,0 +1,30 @@
1
+// https://leetcode.com/problems/minimum-length-of-string-after-operations/description/
2
+
3
+package main
4
5
+import "fmt"
6
7
+func minimumLength(s string) int {
8
+ freq := [26]int{}
9
+ for _, v := range s {
10
+ freq[v-'a']++
11
+ }
12
13
+ res := 0
14
+ for _, v := range freq {
15
+ if v > 0 {
16
+ if v&1 == 1 {
17
+ res += 1
18
+ } else {
19
+ res += 2
20
21
22
23
24
+ return res
25
+}
26
27
+func main() {
28
+ s := "aa"
29
+ fmt.Println(minimumLength(s))
30
0 commit comments