package
0.0.0-20241220224003-b7cf03a90b2b
Repository: https://github.com/szhou12/leetcode-go.git
Documentation: pkg.go.dev
# README
1791. Find Center of Star Graph
Solution idea
My Solution
- 中心节点一定出现在每条边
Time complexity = $O(n)$
入度
- 统计各个节点的度(无向图所以没有区别入度和出度),如果某个节点的度等于这个图边的数量。 那么这个节点一定是中心节点。