Surrounded Regions

AC Rate: 966/6496
My Submissions

Given a 2D board containing 'X' and 'O', capture all regions surrounded by 'X'.

A region is captured by flipping all 'O's into 'X's in that surrounded region .

For example,

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

After running your function, the board should be:

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


You have not signed in, cannot submit your code.
Submit failed, try again please.
You have attempted to resubmit too soon. Please resubmit in a moment.

Send Feedback