FromLeetcodeStatusACDateMay 6, 2024Tags深度优先搜索广度优先搜索Difficulty中等Linkhttps://leetcode.cn/problems/surrounded-regions/description/题面给你一个m x n的矩阵board,由若干字符'X'和'O',找到所有被'X'围绕的区域,并将这些区域里所有的'O'用'X'填充。示例 1:示例 2:提示:m == board.lengthn == board[i].length1 <= m, n <= 200board[i][j] 为 'X' 或 'O' 思路先把边界的O变成A,再遍历整个区域,把O变成X,A变回O 题解深度优先搜索