http://en.wikipedia.org/wiki/Maximum_subarray_problem