The brute force approach is straightforward. We simply evaluate the sum of all possible subarrays and keep track of the maximum sum encountered during the evaluations. The outer loop will determine ...
// first value store, maximum +ve subarray sum possible. // second value store, minimum -ve subarray sum possible, // because minimum of -ve will result in maximum value // if multiplied by -ve number ...