23 lines
282 B
Go
23 lines
282 B
Go
package q3432
|
|
|
|
func countPartitions(nums []int) int {
|
|
sumR := 0
|
|
for i := range nums {
|
|
sumR += nums[i]
|
|
}
|
|
|
|
sumL := 0
|
|
cnt := 0
|
|
|
|
for i := range len(nums) - 1 {
|
|
sumL += nums[i]
|
|
sumR -= nums[i]
|
|
if (sumL-sumR)%2 == 0 {
|
|
cnt++
|
|
}
|
|
}
|
|
|
|
return cnt
|
|
}
|
|
|
|
var _ = countPartitions
|