Create minDistanceInArray