Finds the contiguous subarray with maximum sum in linear time by maintaining a current sum and global max.