mirror of
https://github.com/lWolvesl/leetcode.git
synced 2026-06-04 02:21:15 +08:00
routine
This commit is contained in:
+1
-1
@@ -1,4 +1,4 @@
|
||||
package A
|
||||
package main
|
||||
|
||||
import (
|
||||
"slices"
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package A
|
||||
package main
|
||||
|
||||
func numSpecial(mat [][]int) int {
|
||||
res := 0
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package A
|
||||
package main
|
||||
|
||||
func minPartitions(n string) int {
|
||||
res := 0
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package main
|
||||
|
||||
func minOperations(s string) int {
|
||||
a := 0
|
||||
for i := 0; i < len(s); i++ {
|
||||
expected := byte('0' + i%2)
|
||||
if s[i] == expected {
|
||||
a++
|
||||
}
|
||||
}
|
||||
b := len(s) - a
|
||||
if a < b {
|
||||
return a
|
||||
}
|
||||
return b
|
||||
}
|
||||
Reference in New Issue
Block a user