Skip to content

Commit 5366c57

Browse files
committed
Merge branch 'master' of github.com:kimi0230/LeetcodeGolang
2 parents a673eb1 + bcbde46 commit 5366c57

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"version": 1,
3+
"all_bricks": {
4+
"3455": {
5+
"submit_time": [
6+
1744366857
7+
],
8+
"type": 4,
9+
"review_day": [
10+
1744387200,
11+
1744646400,
12+
1744905600,
13+
1745510400,
14+
1746720000,
15+
1749484800
16+
]
17+
}
18+
}
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* @lc app=leetcode.cn id=3223 lang=golang
3+
* @lcpr version=30104
4+
*
5+
* [3223] 操作后字符串的最短长度
6+
*/
7+
8+
// @lc code=start
9+
func minimumLength(s string) int {
10+
cnt := [26]int{}
11+
for _, c := range s {
12+
cnt[c-'a']++
13+
}
14+
length := 0
15+
for _, x := range cnt {
16+
if x > 0 {
17+
if x%2 == 0 {
18+
length += 2
19+
} else {
20+
length += 1
21+
}
22+
}
23+
}
24+
return length
25+
}
26+
27+
// @lc code=end
28+
29+
/*
30+
// @lcpr case=start
31+
// "abaacbcbb"\n
32+
// @lcpr case=end
33+
34+
// @lcpr case=start
35+
// "aa"\n
36+
// @lcpr case=end
37+
38+
*/

0 commit comments

Comments
 (0)