leetcode130】的更多相关文章

题目: 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 X X O X X O X X After running your function, the board sho…
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. Example: X X X X X O O X X X O X X O X X After running your function, the bo…
(DFS思路对,写复杂了) 给定一个二维的矩阵,包含 'X' 和 'O'(字母 O). 找到所有被 'X' 围绕的区域,并将这些区域里所有的 'O' 用 'X' 填充. 示例: X X X X X O O X X X O X X O X X 运行你的函数后,矩阵变为: X X X X X X X X X X X X X O X X 解释 被围绕的区间不会存在于边界上,换句话说,任何边界上的 'O' 都不会被填充为 'X'. 任何不在边界上,或不与边界上的 'O' 相连的 'O' 最终都会被填充为…
struct POS { int x; int y; POS(int newx, int newy): x(newx), y(newy) {} }; class Solution { public: void solve(vector<vector<char>> &board) { ].empty()) return; int m = board.size(); ].size(); ; i < m; i ++) { ; j < n; j ++) { if(boa…
Problem: 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. For example, X X X X X O O X X X O X X O X X After running your fun…