#3432
Count Partitions with Even Sum Difference
newbie · 120 · lc easy +12 · 85.2% accepted · 403 likes · top 96%
Description
You are given an integer array nums of length n.
A partition is an index i (0 <= i < n - 1) splitting the array into two non-empty subarrays:
- Left subarray: indices [0, i].
- Right subarray: indices [i + 1, n - 1].
Return the number of partitions where the difference between the left and right sums is even.
Code
1
2
3