union find
Vendredimatin
这个作者很懒,什么都没留下…
展开
-
Leetcode 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. Explanation: Surrounded r...原创 2020-02-09 18:58:22 · 193 阅读 · 0 评论 -
Leetcode 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 assume...原创 2020-02-09 17:47:52 · 252 阅读 · 0 评论 -
leetcode 128. Longest Consecutive Sequence
Given an unsorted array of integers, find the length of the longest consecutive elements sequence. Your algorithm should run in O(n) complexity. Example: Input: [100, 4, 200, 1, 3, 2] Output: 4 Explan...原创 2019-07-13 14:31:59 · 154 阅读 · 0 评论