For test cases ["xxx", "xox", "xxx"], my code output in OJ is different from my local machine in both visual studio in Windows and g++ 4.8.2 in Linux. My local result is right whereas OJ's is wrong.

Here is my code:

```
class Solution {
public:
bool helper(const int m, const int n, int x, int y, vector< std::vector<char> >& board) {
bool edge = (x == 0) || (x == m-1) || (y == 0) || (y == n-1);
if (edge && board[x][y] == 'o') return false;
if (board[x][y] == 'x') return true;
if (board[x][y] == '.') return true; // marked as visit
board[x][y] = '.';
bool res = helper(m, n, x-1, y, board) && helper(m, n, x+1, y, board) && helper(m, n, x, y-1, board) && helper(m, n, x, y+1, board);
if (res) board[x][y] = 'x';
else board[x][y] = '.';
return res;
}
void solve(vector< std::vector<char> >& board) {
int m = board.size();
if (m == 0) return;
int n = board[0].size();
int i, j;
for (i = 1; i < m-1; i++) {
for (j = 1; j < n-1; j++) {
if (board[i][j] == 'o') helper(m, n, i, j, board);
}
}
for (i = 0; i < m; i++) {
for (j = 0; j < n; j++) {
if (board[i][j] == '.') board[i][j] = 'o';
}
}
}
};
```