LeetCode 130 Surrounded Regions - Problem Statement

The problem

Given an m × n board with 'X' and 'O', capture all regions of 'O' that are completely surrounded by 'X'.

A region is captured by flipping all 'O's to 'X's. Regions connected to the border cannot be captured.

With board:

X X X X
X O O X
X X O X
X O X X

After capturing:

X X X X
X X X X
X X X X
X O X X

The 'O' at (3,1) is connected to the border (left edge), so it's not captured.

Constraints: 1m,n2001 \le m, n \le 200.