Tap here to switch tabs
Problem
Submissions

Problem: Count Partitions with Even Sum Difference

Count Partitions with Even Sum Difference asks you to split an array of positive integers into two nonempty contiguous parts and return how many splits give both part sums the same parity.

Statement

You are given an integer array nums of length n.

A partition is formed by splitting nums into two non empty contiguous subarrays: a left subarray consisting of elements from index 00 to index i, and a right subarray consisting of elements from index i + 1 to index n - 1, where 0≤i<n−10 \leq i < n - 1.

Return the number of partitions where the difference between the sum of elements in the left subarray and the sum of elements in the right subarray is even.

Constraints:

  • 2≤n==2 \leq n == nums.length ≤100\leq 100

  • 1≤1 \leq nums[i] ≤100\leq 100

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Count Partitions with Even Sum Difference

Count Partitions with Even Sum Difference asks you to split an array of positive integers into two nonempty contiguous parts and return how many splits give both part sums the same parity.

Statement

You are given an integer array nums of length n.

A partition is formed by splitting nums into two non empty contiguous subarrays: a left subarray consisting of elements from index 00 to index i, and a right subarray consisting of elements from index i + 1 to index n - 1, where 0≤i<n−10 \leq i < n - 1.

Return the number of partitions where the difference between the sum of elements in the left subarray and the sum of elements in the right subarray is even.

Constraints:

  • 2≤n==2 \leq n == nums.length ≤100\leq 100

  • 1≤1 \leq nums[i] ≤100\leq 100