Difficulty:
Given an array of integers, find what the highest sum of numbers in a non-empty contiguous subarray is. For example,
[-1, -2, -3]
has[-1]
which sums up to-1
, and[1, -10, 2, 4, -5, 5]
has[2, 4]
that amounts to6
.
maxSubarray([ 1, -10, 2, 4, -5, 5 ]);
6