You are give an array, where each item of the array represent the number of items for a type. Type of the item is presented by the index.
so, a[i] is the number of items, i - th index is the type.
Find the minimum sum of items needed to be added by type, so that you can evenly distribute each item by type among two or more portions.
e.g. array = [4,7,5,11,15], you have to add [0,1,1,1,1] more items, which sums to 4, to evenly distribute in two portions.
[4,8,6,12,16] => [2,4,3,6,8] and [2,4,3,6,8]
or add [2,2,1,1,0] = 6, so that now you have [6, 9, 6, 12, 15], that you can devide into three portions of [2,3,2,4,5].
and so on ..
Min sum is 4, which is required in case of two portions.
Example 2: [3,9,7,6,5,2]
for 2 portions, you can add [1,1,1,0,1,0] = 4, of [2,5,4,3,3,1]
and for 3 portions, you can add [0,0,2,0,1,1] = 4, of [1, 3, 3, 2, 2, 1]
for any case >= 3, 4 is the min sum.
0 <= i <= 10000
1 <= a[i] <= 2**32 - 1