True story: A former student of one of the authors gave this very algorithm during
a job interview for a major software company, when asked about the maximum
subarray problem, correctly observing that this algorithm beats the running time of
the naive O(n3)-time algorithm by a linear factor. Sadly, this student did not get a
job offer, however, and one reason could have been because there is an even better
solution to the maximum subarray problem, which the student didn’t give.