Skip to content

Practice Count Partitions with Even Sum Difference

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Easy#3432
LeetCode Problem

Count Partitions with Even Sum Difference

Problem Statement

You are given an integer array nums of length n. A partition is defined as an index i where 0 <= i < n - 1, splitting the array into two non-empty subarrays such that: Return the number of partitions where the difference between the sum of the left and right subarrays is even.

Source: Count Partitions with Even Sum Difference on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
nums = [10,10,3,7,6]
Output
4

# Example 2

Input
nums = [1,2,2]
Output
0

# Example 3

Input
nums = [2,4,6,8]
Output
3

Constraints

2 <= n == nums.length <= 100
1 <= nums[i] <= 100

Related LeetCode Problems

Practice more problems similar to Count Partitions with Even Sum Difference.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.