You are given a sequence A1, A2, ... , An, - 1000 ≤ Ai ≤ 1000, 1 ≤ n ≤ 1000.
You can split this sequence into contiguous non-empty parts
.
Your task is to find the maximum value . If k = 1 then sum equal to 0.
Can anyone help me come up with solution?