typestatusdateslugsummarytagscategoryiconpassword创建时间Dec 30, 2025 01:42 PM给你一个整数 n ,表示一张 无向图 中有 n 个节点,编号为 0 到 n - 1 。同时给你一个二维整数数组 edges ,其中 edges[i] = [ai, bi] 表示节点 ai 和 bi 之间有一条 无向 边。请你返回 无法互相到达 的不同 点对数目 。https://leetcode.cn/problems/count-unreachable-pairs-of-nodes-in-an-undirected-graph/description/深度优先遍历通过 isVisted 数组来分辨连通分量,并统计每个连通分量的数量。深度优先遍历——返回值在设置返回值的时候,需要注意!!!📎 参考无