首页 > TAG信息列表 > surrounded
LeetCode 130 Surrounded Regions 连通块DFS
Given an m x n matrix board containing 'X' and 'O', capture all regions that are 4-directionally surrounded by 'X'. A region is captured by flipping all 'O's into 'X's in that surrounded region. Solution 如LeetCode - Surrounded Regions
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 XLeetCode——surrounded-regions
Q:现在有一个仅包含‘X’和‘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 A: 1.与边界上面Picture of a diver surrounded by hundreds of fish
Picture of a diver surrounded by hundreds of fishLeetCode-130-Surrounded Regions
算法描述: 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