Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Can we build a graph from words, where there exists an edge between nodes i and j if words[i] and words[j] are connected?
The problem now boils down to finding the total number of components and the size of the largest component in the graph.
How can we use bit masking to reduce the search space while adding edges to node i?