find max subarray non-recursive