Tap here to switch tabs
Problem
Submissions

Problem: Ways to Make a Fair Array

med
30 min
Try to solve the Ways to Make a Fair Array problem.

Statement

You are given an integer array nums.

An array is considered fair if the sum of elements at even indices is equal to the sum of elements at odd indices.

When you remove exactly one element at index i, the indices of all elements located after index i shift to the left by 11.

Return the total number of indices i that you can remove such that the remaining array becomes fair.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • 1≤1 \leq nums[i] ≤104\leq 10^4

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Ways to Make a Fair Array

med
30 min
Try to solve the Ways to Make a Fair Array problem.

Statement

You are given an integer array nums.

An array is considered fair if the sum of elements at even indices is equal to the sum of elements at odd indices.

When you remove exactly one element at index i, the indices of all elements located after index i shift to the left by 11.

Return the total number of indices i that you can remove such that the remaining array becomes fair.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • 1≤1 \leq nums[i] ≤104\leq 10^4