并查集

Question721 账户合并

  • DFS,BFS请参考回溯

    2092题 知晓秘密的所有专家

  • 本题中利用了并查集路径压缩的优势,写一个避免bug的find写法,即parent[find(p1)]=parent[find(p2)];