// findMaxSubarrayImpl return left-index, right-index and sum value of the subarray
findMaxSubarrayImpl return left-index, right-index and sum value of the subarray
// findMaxSubarrayImpl return left - index right - index and sum value of the subarray
func findMaxSubarrayImpl(in []int, low, high int) (int, int, int) {
	if low == high {
		return low, high, in[low]
	}
	mid := (low + high) / 2
	leftLow, leftHigh, leftSum := findMaxSubarrayImpl(in, low, mid)
	rightLow, rightHigh, rightSum := findMaxSubarrayImpl(in, mid+1, high)
	crossingLow, crossingHigh, crossingSum := findMaxCrossingSubarray(in, low, mid, high)
	if leftSum >= rightSum && leftSum >= crossingSum {
		return leftLow, leftHigh, leftSum
	}
	if rightSum >= leftSum && rightSum >= crossingSum {
		return rightLow, rightHigh, rightSum
	}
	return crossingLow, crossingHigh, crossingSum
}
func findMaxSubarrayImpl ( in [ ] int , low , high int ) ( int , int , int ) { if low == high { return low , high , in [ low ] } mid := ( low + high ) / 2 leftLow , leftHigh , leftSum := findMaxSubarrayImpl ( in , low , mid ) rightLow , rightHigh , rightSum := findMaxSubarrayImpl ( in , mid + 1 , high ) crossingLow , crossingHigh , crossingSum := findMaxCrossingSubarray ( in , low , mid , high ) if leftSum >= rightSum && leftSum >= crossingSum { return leftLow , leftHigh , leftSum } if rightSum >= leftSum && rightSum >= crossingSum { return rightLow , rightHigh , rightSum } return crossingLow , crossingHigh , crossingSum }
findMaxSubarrayImpl return left-index, right-index and sum value of the subarray
findMaxSubarrayImpl return left - index right - index and sum value of the subarray
//else if //else