union-find
胡啦啦
这个作者很懒,什么都没留下…
展开
-
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 assume原创 2017-03-09 14:27:48 · 222 阅读 · 0 评论 -
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, X X X X X O O原创 2017-03-09 15:22:03 · 226 阅读 · 0 评论 -
Longest Consecutive Sequence
Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example, Given [100, 4, 200, 1, 3, 2], The longest consecutive elements sequence is [1, 2, 3, 4].原创 2017-03-09 21:16:44 · 236 阅读 · 0 评论