| 32 | } |
| 33 | |
| 34 | int numIslands(vector<vector<char>>& grid) { |
| 35 | m = grid.size(); |
| 36 | if (m == 0) return 0; |
| 37 | n = grid[0].size(); |
| 38 | if (n == 0) return 0; |
| 39 | cnt = 0; |
| 40 | g.clear(); |
| 41 | for (auto & i : grid) |
| 42 | g.push_back(i); |
| 43 | for (int i = 0; i < m; i ++ ) { |
| 44 | for (int j = 0; j < n; j ++ ) { |
| 45 | if (g[i][j] == '1') { |
| 46 | cnt ++ ; |
| 47 | traverse(i, j); |
| 48 | } |
| 49 | } |
| 50 | } |
| 51 | return cnt; |
| 52 | } |
| 53 | }; |
| 54 | |
| 55 | int main() { |
nothing calls this directly
no outgoing calls
no test coverage detected