classNumIslands{publicintnumIslands(char[][] grid){int m = grid.length, n = grid[0].length, res =0;for(int i =0;i < m;i++){for(int j =0;j < n;j++){if(grid[i][j]=='1'){res++;dfs(grid, i, j);}}}return res;}publicvoiddfs(char[][] grid,int i,int j){if(i <0|| i >= grid.length || j <0|| j >= grid[0].length || grid[i][j]=='0'){// 终止条件return;}grid[i][j]='0';dfs(grid, i -1, j);dfs(grid, i +1, j);dfs(grid, i, j -1);dfs(grid, i, j +1);}}
JetBrains最近推出的Rust集成开发工具——RustRover已经发布,官方网站:RustRover: Rust IDE by JetBrains JetBrains出品过很受欢迎的开发工具IntelliJ IDEA、PyCharm等。 RustRover优势
Rust集成环境,根据向导可自动下载安装rust开发环境提…