You are 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. An 'O' is not captured if it is on the border, or if it is connected to an 'O' that is on the border.
Border-First Search (Pruning)
Instead of checking every 'O' to see if it's surrounded, we focus on the 'O's that are DEFINITELY NOT surrounded. These are the 'O's on the border and any 'O's connected to them. We can use DFS/BFS to mark these 'Safe' cells. Finally, any 'O' that isn't marked 'Safe' must be captured (flipped to 'X').