![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
并查集
傅里叶不想变换_
这个作者很懒,什么都没留下…
展开
-
1034 (DFS)Head of a Gang (并查集)
One way that the police finds the head of a gang is to check people’s phone calls. If there is a phone call between A and B, we say that A and B is related. The weight of a relation is defined to be t...原创 2020-04-27 09:45:36 · 123 阅读 · 0 评论 -
1107 Social Clusters(并查集)
When register on a social network, you are always asked to specify your hobbies in order to find some potential friends with the same hobbies. A social cluster is a set of people who have some of thei...原创 2020-04-25 16:08:18 · 123 阅读 · 0 评论 -
1076(并查集) Forwards on Weibo
Weibo is known as the Chinese version of Twitter. One user on Weibo may have many followers, and may follow many other users as well. Hence a social network is formed with followers relations. When a ...原创 2020-04-26 10:29:07 · 116 阅读 · 0 评论 -
Leetcode 547. 朋友圈
思路1:实质上就是求无向图连通块的个数,我们从每个未被访问的节点开始深度优先遍历,每开始一次搜索就增加 count 计数器一次 class Solution { public int findCircleNum(int[][] M) { int n = M.length; int[] visited = new int[n]; int count = 0; for(int i = 0; i < M.length; i++){ .原创 2020-12-27 15:16:20 · 58 阅读 · 0 评论