find_max_subarray with different implemention