solved sumOfMinAndMax