private void dfs(char[][] board, int i, int j) {
        if (i < 0 || i >= board.length || j < 0 || j >= board[0].length) {
            return;
        }

        if (board[i][j] != 'O') {
            return;
        }

        board[i][j] = '1';
        if (i < board.length - 2) {
            dfs(board, i + 1, j);
        }
        if (i > 1) {
            dfs(board, i - 1, j);
        }
        if (j < board[0].length - 2) {
            dfs(board, i, j + 1);
        }
        if (j > 1) {
            dfs(board, i, j - 1);
        }
    }
Date 04/17/2016
@author Tushar Roy

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.

Reference
https://leetcode.com/problems/surrounded-regions/
src/com/interview/graph/FillOsWIthXsIfSurroundedByXs.java