Kadane's Algorithm Pattern

Maximum subarray via running local optima.