Games 24x7 onsite round

Given a data set, find all the connected components.

Example:
Input : [[1,3,5], [2,5], [7,8], [3,2]]
Output : [[1,2,3,5],[7,8]]
Comments (2)