Optum interview question

An extended version of Kadane's algorithm.