被围绕的区域。题意是给一个二维矩阵,用大写的X和O(欧,不是零)填满。请找到所有被 'X' 围绕的区域,并将这些区域里所有的 'O' 用 'X' 填充。例子, Example: X X X X X O O X X X O X X O X X After running your function, ...
分类:
其他好文 时间:
2020-05-02 09:37:14
阅读次数:
55
1 """ 2 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 ...
分类:
其他好文 时间:
2020-02-15 23:28:19
阅读次数:
68
题目:给定一个二维的矩阵,包含 'X' 和 'O'(字母 O)。找到所有被 'X' 围绕的区域,并将这些区域里所有的 'O' 用 'X' 填充。 来源:https://leetcode-cn.com/problems/surrounded-regions/ 法一:自己的代码 思路:先绕外围走一圈,将 ...
分类:
其他好文 时间:
2020-02-10 22:16:58
阅读次数:
81
Description Given a 2D board containing 'X' and 'O', capture all regions surrounded by 'X'. Description Given a 2D board containing 'X' and 'O', captu ...
分类:
其他好文 时间:
2019-12-22 00:10:57
阅读次数:
82
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 adjacen ...
分类:
其他好文 时间:
2019-12-05 12:59:30
阅读次数:
81
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 ...
分类:
其他好文 时间:
2019-09-19 14:21:33
阅读次数:
72
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 adjacen ...
分类:
其他好文 时间:
2019-05-29 18:11:06
阅读次数:
102
[toc] 题目链接 "https://leetcode.com/problems/surrounded regions/" 注意点 边缘不算包围‘O’ 解法 解法一:dfs。找处在边缘上的 然后dfs将与之相邻的 都改为 。处理完之后再把这时候的 改为 , 改为 即可 解法二:bfs。基本上一样的 ...
分类:
其他好文 时间:
2019-04-10 23:37:56
阅读次数:
149
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 adjacen ...
分类:
其他好文 时间:
2019-02-22 18:16:29
阅读次数:
139
One small letter, surrounded by EXACTLY three big bodyguards on each of its sides. ...
分类:
编程语言 时间:
2019-02-15 23:52:47
阅读次数:
295