Leetcode - 130. Surrounded Regions

The Problem 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. Link to the problem: https://leetcode.com/problems/surrounded-regions The solution So the problem here lies in how to find the regions of 'O's. Once that it's clear, what we need to do is find all the regions of 'O's and check if they're completely surrounded by ' X's. For all those regi...
Read post