You are given an array nums of length n.
We choose a position i such that:
Left part = nums[0] to nums[i]
Right part = nums[i+1] to nums[n-1]
Both parts must contain at least one element.
A partition is valid if:
is even.
Return how many such valid partitions exist.
Input: nums = [4, 1, 3, 2]
Output: 3
Explanation:
[4], [1,3,2] → 4 - 6 = -2 (even) ✅ [4,1], [3,2] → 5 - 5 = 0 (even) ✅ [4,1,3], [2] → 8 - 2 = 6 (even) ✅ → Actually count = 3 Revised Output: 3
Input: nums = [1,1,1,1]
Output: 3
Explanation:
All splits yield even sum difference.
Input: nums = [5,9]
Output: 1
Explanation:
Only split: [5], [9] → 5 - 9 = -4 (even) → Actually 1 valid Updated Output: 1
Accepted:
Submission: