#include <leetcode.h>
|
static void | dfs (vector< vector< char > > &board, int x, int y) |
|
static void | solve (vector< vector< char > > &board) |
|
◆ dfs()
void leetcode::surrounded_regions::Solution::dfs |
( |
vector< vector< char > > & |
board, |
|
|
int |
x, |
|
|
int |
y |
|
) |
| |
|
static |
在文件 leetcode.cpp 第 6393 行定义.
6395 const int m = board.size();
6396 const int n = board[0].size();
6397 pair<int, int> nexts[4] = {{x - 1, y}, {x + 1, y}, {x, y - 1}, {x, y + 1}};
6398 for(
auto [next_x, next_y]: nexts) {
6399 if(next_x >= 0 && next_x < m && next_y >= 0 && next_y < n && board[next_x][next_y] ==
'O') {
6400 dfs(board, next_x, next_y);
static void dfs(vector< vector< char > > &board, int x, int y)
引用了 dfs().
被这些函数引用 dfs() , 以及 solve().
◆ solve()
void leetcode::surrounded_regions::Solution::solve |
( |
vector< vector< char > > & |
board | ) |
|
|
static |
在文件 leetcode.cpp 第 6362 行定义.
6363 const int m = board.size();
6364 const int n = board[0].size();
6365 for(
int i = 0; i < n; i++) {
6366 if(board[0][i] ==
'O') {
6369 if(board[m - 1][i] ==
'O') {
6370 dfs(board, m - 1, i);
6373 for(
int j = 0; j < m; j++) {
6374 if(board[j][0] ==
'O') {
6377 if(board[j][n - 1] ==
'O') {
6378 dfs(board, j, n - 1);
6381 for(
int i = 0; i < m; i++) {
6382 for(
int j = 0; j < n; j++) {
6383 if(board[i][j] ==
'O') {
6386 if(board[i][j] ==
'D') {
引用了 dfs().
该类的文档由以下文件生成: