#C2551. Minimum Absolute Difference of Contiguous Subarray Sums
Minimum Absolute Difference of Contiguous Subarray Sums
Minimum Absolute Difference of Contiguous Subarray Sums
Given an array of N integers, partition the array into two non-empty contiguous subarrays. Let \(S_{\text{left}}\) be the sum of the elements in the left subarray and \(S_{\text{right}}\) be the sum in the right subarray. Your task is to find a partition that minimizes the absolute difference \(|S_{\text{left}} - S_{\text{right}}|\).
Note: The partition must be done such that both subarrays are non-empty. You need to output the minimum possible absolute difference.
inputFormat
The first line contains an integer N
representing the number of elements in the array. The second line contains N
space-separated integers representing the elements of the array.
outputFormat
Output a single integer denoting the minimum absolute difference between the sums of the two contiguous subarrays.
## sample5
1 2 3 4 5
3