logo
Interview
    Interview Guide
    Coding Problems List
Sponsored: Coursera
Problems

Surrounded Regions

Problem

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

A region is captured by flipping all Os into Xs 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

Online Judge