First is convert subset to set, which enable us to have O(1) find, and since intuitively we check two node is a group or not to check if it is connecting. So now we mainly work on the whole list, then check first if current node if in the subset, second check if currently we are connecting or not.
Error:
N/A