# Leetcode 130 - Surrounded regions

Note:

• It’s really hard to find the wall that surrounds some Os.
• Instead, any Os on the border and Os that are connected to them cannot be surrounded by X.
• Use DFS to start from Os on the border and mark all connected Os.

Question:

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.

Example:

Code: