Here is my BFS, nothing special, but got an TLE on the big input. I saw other people got passed and mine DFS as well. Do I make any typo? Thanks for pointing it out!!!

```
void bfs(vector<vector<char>>& grid, int i, int j)
{
queue<pair<int, int>> qe;
qe.push({i, j});
while(!qe.empty())
{
pair<int, int> pt = qe.front();
qe.pop();
int row = pt.first, col = pt.second;
grid[row][col] = 'x';
if(row > 0 && grid[row - 1][col] == '1')
qe.push({row - 1, col});
if(col > 0 && grid[row][col - 1] == '1')
qe.push({row, col - 1});
if(row < (grid.size() - 1) && grid[row + 1][col] == '1')
qe.push({row + 1, col});
if(col < (grid[0].size() - 1) && grid[row][col + 1] == '1')
qe.push({row, col + 1});
}
}
int numIslands(vector<vector<char>>& grid) {
int res = 0;
for(int i = 0; i < grid.size(); ++i)
{
for(int j = 0; j < grid[0].size(); ++j)
{
if(grid[i][j] == '1')
{
bfs(grid, i, j);
res++;
}
}
}
return res;
}
```