Problem
A board holds "X" and "O" cells. A group of "O" cells connected up, down, left or right is captured when none of its cells lies on the edge of the board: flip every cell of a captured group to "X". Groups that touch the border survive. Change board in place; the function returns nothing.
Example 1
X X X X X X X X
Example 2
- Input
- X O O X
- Output
- X X X X
Example 3
X X O X X X X X
Example 4
X O X X X O X X (the bottom O touches the border, so it stays)
Constraints
1 <= board.length, board[i].length <= 200board[i][j] is "X" or "O"