题目:Given a 2D board containing'X'and'O', capture all regions surrounded by'X'.A region is captured by flipping all'O's into'X's in that surrounded reg...
分类:
其他好文 时间:
2015-05-26 12:06:37
阅读次数:
131
Given a 2D board containing 'X' and '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 X...
分类:
其他好文 时间:
2015-05-24 13:03:25
阅读次数:
166
Surrounded Regions问题:Given a 2D board containing'X'and'O', capture all regions surrounded by'X'.A region is captured by flipping all'O's into'X's in t...
分类:
其他好文 时间:
2015-05-06 12:28:08
阅读次数:
118
Given a 2D board containing'X'and'O', capture all regions surrounded by'X'.A region is captured by flipping all'O's into'X's in that surrounded region...
分类:
其他好文 时间:
2015-05-03 21:53:42
阅读次数:
205
题目:Given a 2D board containing'X'and'O', capture all regions surrounded by'X'.A region is captured by flipping all'O's into'X's in that surrounded reg...
分类:
其他好文 时间:
2015-05-03 01:58:32
阅读次数:
119
Shaping RegionsTime Limit:1 SecMemory Limit:128 MBSubmit:124Solved:39[Submit][Status][Web Board]DescriptionN opaque rectangles (1 #include #include #i...
problem:
Given a 2D board containing 'X' and '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,
...
分类:
其他好文 时间:
2015-04-28 18:36:50
阅读次数:
140
给定一个由字符'X'和‘O’组成的矩阵,消除所有被‘X’包围的‘O’ X X X XX O O XX X O XX O X X变成X X X XX X X XX X X XX O X X思路:有点像围棋里一块区域是否有气,只有有气的才能存活下来。即只有‘O’到达了四条边界才可以存活,因此从四条边界开...
分类:
其他好文 时间:
2015-04-10 21:40:06
阅读次数:
152
Given a 2D board containing'X'and'O', capture all regions surrounded by'X'.A region is captured by flipping all'O's into'X's in that surrounded region...
分类:
其他好文 时间:
2015-04-05 20:14:30
阅读次数:
147
题目:Surrounded Regions
广搜和深搜都能解决,但是LeetCode上使用深搜时会栈溢出
DFS:
/*LeetCode Surrounded Regions
* 题目:给定一个字符数组,由'X'和'O'组成,找到所有被x包围的o并将其替换为x
* 思路:只要替换被包围的o就行,如果有一个o是边界或者上下左右中有一个是o且这个o不会被替换,则该点也不会被替换
* 从四条...
分类:
其他好文 时间:
2015-03-29 00:42:51
阅读次数:
204