Given an integer array arr, we define value v over a partition of arr as sum of maximum of "each part of arr after partition", such that each part must contain atleast 1 negative number
Eg: [10, -2, 5, -3, 4, -1]
Maximum value is given by partition:
[10, -2] [5, -3] [4, -1]
10 + 5 + 4
19 is the answer
Now we want to find maximum value of arr
O(N*N) approach is straightforward, any better approach?
Comments (13)


