mirror of
https://github.com/lWolvesl/leetcode.git
synced 2026-06-04 02:21:15 +08:00
routine
This commit is contained in:
@@ -1,11 +0,0 @@
|
|||||||
package A
|
|
||||||
|
|
||||||
func minCost(n int, edges [][]int) int {
|
|
||||||
edgeM := make([][]int, n)
|
|
||||||
for i := 0; i < n; i++ {
|
|
||||||
edgeM[i] = make([]int, n)
|
|
||||||
}
|
|
||||||
for _, e := range edges {
|
|
||||||
edgeM[e[0]][e[1]] = e[2]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package A
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"slices"
|
"slices"
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package A
|
package main
|
||||||
|
|
||||||
func numSpecial(mat [][]int) int {
|
func numSpecial(mat [][]int) int {
|
||||||
res := 0
|
res := 0
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package A
|
package main
|
||||||
|
|
||||||
func minPartitions(n string) int {
|
func minPartitions(n string) int {
|
||||||
res := 0
|
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