Java
class Solution {
public void solve(char[][] board) {
if(board.length == 0 ) return;
int row = board.length;
int col = board[0].length;
for (int i = 0; i < row; i++) {
if (board[i][0] == 'O') helper(board,i,0);
if (board[i][col-1] == 'O') helper(board,i,col-1);
}
for (int i = 0; i < col; i++) {
if (board