Qn 3 why does the number of connected components decreases when new connections are pushed, but increases when recent connections are popped?
3

I don't understand the sample input and output, given that we start with an empty network, shouldn't the number of connected components start as 0? After you push 1-2, how does it become 4?

Replies ()
Sort by:

?