Tap here to switch tabs
Problem
Submissions

Problem: Count Partitions with Even Sum Difference

med
30 min
Try to solve the Count Partitions with Even Sum Difference problem.

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

med
30 min
Try to solve the Count Partitions with Even Sum Difference problem.

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