Given a double linked list, and a set of node pointers, find how many connected components in the set.

  • 1

    For example, if a double linked list is: 1-2-3-4-5 and set contains pointers to [1 , 2, 5], this set contains 2 componments, one is [ 1 2], second is [5] since [5] is disconnected. The set [1 2 3 4 5] contains only one componment since everything is connected.

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.