We’re preparing your current view and syncing the latest data.
You are given a 0-indexed integer array nums. The array nums is called fair if the sum of elements at even indices equals the sum of elements at odd indices.
Return the number of indices you can remove from the array to make it fair.
Example: Input: nums = [2,1,6,4] Output: 1 Explanation: Removing index 1 results in the array [2,6,4], sum of elements at even indices = 2 + 4 = 6 and sum of elements at odd indices = 6. This is the only way to make the array fair.
An integer array nums.
An integer representing the number of ways to make the array fair by removing one element.
1 <= nums.length <= 10^5 1 <= nums[i] <= 10^4
Example 1
Input
[2,1,6,4]
Output
1
Explanation
Removing element at index 1 results in a fair array.