I'm a beginner for programming with Mathematica and have a simple question.
Suppose we have a list of lists, for example,
lalist = {{1,3}, {2,3}, {4}}
I want to gather the lists if they have a common element. For example,
{{1,2,3}, {4}}
Another nontrivial example would be
lblist = {{1}, {1,4}, {2,3}, {5,6}, {2,4}}
(*{{1,2,3,4}, {5,6}}*)
Length of each list is less than 2. Thanks.