LeetCode那个surrounded regions解法不对吧?# JobHunting - 待字闺中
u*l
1 楼
http://discuss.leetcode.com/questions/1223/surrounded-regions
First scan the four edges of the board, if you meet an 'O', call a
recursive mark function to mark that region to something else (for example,
'+');
scan all the board, if you meet an 'O', flip it to 'X';
scan again the board, if you meet an '+', flip it to 'O';
如果是
XXX
OOX
XXX
第二个O没有被X环绕,解法里面却变为X。
First scan the four edges of the board, if you meet an 'O', call a
recursive mark function to mark that region to something else (for example,
'+');
scan all the board, if you meet an 'O', flip it to 'X';
scan again the board, if you meet an '+', flip it to 'O';
如果是
XXX
OOX
XXX
第二个O没有被X环绕,解法里面却变为X。