Largest subarray in array algorithm