Given an array of length , your task is divide array into two non-empty subarray such that each of element present in the array must belong to exactly one subarray and the Good value is defined as the absolute difference between sum of both subarrays ( Let a be the sum of first subarray and b be the sum of second subarray , therefore it's Good Value is ). Your task is to find the minimum possible Good Value of array .
The first line contains , the size of array
The second line contains space seperated integers, the elements of
Output minimum Good Value possible for array
In the given test case, array A = { 6, 3, 7, 1, 2, 5 }
Two subarrays are {6, 3} and {7, 1, 2, 5}
Absolute difference between their sum is abs( (6+3) - (7+1+2+5) ) = abs(9-15) = 6