Google·Software Engineer·Technical Phone Screen
- Given an integer array where each element is a two-digit number, define two numbers as connected if they share at least one digit (tens or ones). Connectivity is transitive. Find the size of the largest connected component in the array.
“I went straight for union-find and it worked, but I wasted probably five minutes convincing myself it was the right tool when BFS over adjacency would've been cleaner to explain out loud.”