Implemented Kadane's for linear-time maxsubarray.