Find subarray with maximum in a given array