Thanks for your code, very impressive.
Now your code cannot pass because of the newly added test case ,[,]
I add a little code to handle it.
The core idea is to add all possible node into graph and then compare org's size with graph's size.
Smarking Algorithm Contest 2
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.