import java.util.*; public class Solution { public int solve (char[][] grid) { int number = 0; for (int i = 0; i < grid.length; i++) { for (int j = 0; j < grid[i].length; j++) { if (grid[i][j] == '1') { dfs(grid, i, j); ...