Linear time method

Kadane’s Algorithm