sumOfMinAndMax problem solved