
Union Find
文章平均质量分 77
zshouyi
这个作者很懒,什么都没留下…
展开
-
200. Number of Islands
Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may assu原创 2017-06-04 14:01:30 · 312 阅读 · 0 评论 -
261. Graph Valid Tree
Given n nodes labeled from 0 to n - 1 and a list of undirected edges (each edge is a pair of nodes), write a function to check whether these edges make up a valid tree.For example:Given n =原创 2017-06-10 05:08:42 · 338 阅读 · 0 评论 -
323. Number of Connected Components in an Undirected Graph
Given n nodes labeled from 0 to n - 1 and a list of undirected edges (each edge is a pair of nodes), write a function to find the number of connected components in an undirected graph.Example 1:原创 2017-06-10 05:27:06 · 582 阅读 · 0 评论 -
547. Friend Circles
There are N students in a class. Some of them are friends, while some are not. Their friendship is transitive in nature. For example, if A is a direct friend of B, and B is a direct friend of C, the原创 2017-06-14 01:33:53 · 259 阅读 · 0 评论 -
130. Surrounded Regions
Given a 2D board containing 'X' and 'O' (the letter O), capture all regions surrounded by 'X'.A region is captured by flipping all 'O's into 'X's in that surrounded region.For example,原创 2017-06-14 12:30:41 · 268 阅读 · 0 评论