This commit is contained in:
2025-12-05 03:26:44 +08:00
parent affa209d93
commit 0fd446de99
7 changed files with 65 additions and 4 deletions

View File

@@ -1,4 +1,4 @@
package D
package L12
func prefixesDivBy5(nums []int) []bool {
ans := make([]bool, len(nums))

View File

@@ -1,4 +1,4 @@
package C
package L12
func kLengthApart(nums []int, k int) bool {
last := -k - 1

View File

@@ -1,4 +1,4 @@
package A
package L12
func minCost(colors string, neededTime []int) int {
count := 0

View File

@@ -1,4 +1,4 @@
package B
package L12
func minOperations(nums []int) int {
n, gcdAll, cnt1 := len(nums), 0, 0

22
25/11/go/3432.go Normal file
View File

@@ -0,0 +1,22 @@
package L12
func countPartitions(nums []int) int {
n := len(nums)
count := 0
prefix := make([]int, n)
for i, v := range nums {
count += v
prefix[i] = count
}
ans := 0
for i, v := range prefix {
if i == n-1 {
break
}
if (count-2*v)%2 == 0 {
ans++
}
}
return ans
}