leecodecode【面试150】【2026.7.2打卡-java版本】
被围绕的区域
要点:bfs
class Solution {public void solve(char[][] board) {//bfsint m board.length;int n board[0].length;for(int j 0; j < n; j){if(board[0][j] O){bfs(0, j, board);}if(board[m-1][j] O){bfs(m-1, j, board);}}for(int i 0; i …