Maximum subarray problem / Kadane's algorithm