Kadane's Algorithm
Time complexity: O(n).
Auxiliary space: O(1).
The algorithm works with negative values when initialized correctly.
The decision is based on whether extending the previous subarray improves the current sum.
The algorithm can be extended to track the actual start and end indexes of the best subarray.