Back to problems

Find largest group of two-digit numbers sharing digits

Algorithm · Google · Medium

Given an integer array nums of length n. Every element is a two-digit integer. For a two-digit integer, its digits are the tens digit and the ones digit. Two elements are linked if their digit sets have a non-empty intersection — in other words, if they share at least one digit. A group is a maximal collection of elements in which every element can be reached from every other element through a chain of linked pairs. Direct digit sharing is not required between every pair in…

Checking your access…