max subarray with linear running time