> For the complete documentation index, see [llms.txt](https://851958789.gitbook.io/notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://851958789.gitbook.io/notes/0130_surrounded_regions/slt.md).

# 思路1

用排除法：先找到所有连接起来与边界连通的O，将这些O标记一下，然后遍历数组，所有没有被标记的O就是我们要找的O。

首先对边界上每一个'O'做深度优先搜索，将与其相连的所有'O'改为'-'。

然后遍历矩阵，将矩阵中所有'O'改为'X',将矩阵中所有'-'变为'O'
