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 assum...
分类:
其他好文 时间:
2015-04-09 08:49:41
阅读次数:
134
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 ...
分类:
其他好文 时间:
2015-04-09 00:59:17
阅读次数:
146
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 ...
分类:
其他好文 时间:
2015-04-08 14:31:36
阅读次数:
122
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
目录
目录
前言
题目
思路1DFS
思路2BFS
前言
最近这两天为了解决Android Rom适配一个底层的问题,天天熬夜到2点,导致原定了LeetCode刷题计划都受到了影响。昨晚终于熬夜搞定,补充一道LeetCode解题报告。
题目
Given a 2D board containing ‘X’ and ‘O’, capture all regions sur...
分类:
其他好文 时间:
2015-03-20 20:29:23
阅读次数:
127
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-03-02 19:07:23
阅读次数:
115
Beijing was once surrounded by four rings of city walls: the Forbidden City Wall, the Imperial City Wall, the Inner City Wall, and finally the Outer C...
分类:
其他好文 时间:
2015-02-27 16:27:30
阅读次数:
183
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-02-11 18:43:33
阅读次数:
131
uva 1335 Beijing Guards
Beijing was once surrounded by four rings of city walls: the Forbidden City Wall, the Imperial City Wall, the Inner City Wall, and finally the Outer City Wall. Most of t...
分类:
其他好文 时间:
2015-01-31 12:41:54
阅读次数:
234