given an array of numbers find the largest subarray of numbers to be negated to obtain the maximum sum.
Answers
Answered by
0
Write a program to calculate the minimum sum of this array as well as the sum should be >= 0.
For example : Array = {1,2,4,5} then sum = 0 as we change sign of 1 and 5 {-1,2,4,-5}, Take 12,13,14,15,16,50.
My code would change 50 to -50 and stop (i.e min sum = 20). But the answer should be 12,-13,-14,-15,-16, 50 (min sum = 4).
Similar questions