Yes - loge, the search does get messy but I think the phrase in the preamble - ''no two groups sharing a cell edge'' - would have been much simpler if contact is to be avoided entirely ('no two groups touching'?). And if this is uniquely possible, why not highlight them?
gitto, quiz, I have also settled on a single contact - a touching corner between the bottom two groups. But if one corner is OK, why not allow several and have multiple possible highlightings? Alternately, if a corner counts as 'contiguous' I could highlight all of the groups without any contact between them at all and still satisfy the 39/40 condition (as it is, my groups all touch along cell edges).
Unless someone finds a better route - and there are umpteen possibilities - it looks like either/or for the contiguous groups but both (39 & 40) for the number of cells involved.