count islands
public class Solution {
public int numIslands(char[][] grid) {
int rows = grid.length;
int cols = grid[0].length;
int islandCount = 0;
// Traverse every cell in the grid
for (int r = 0; r < rows; r++) {
...
yesamitsingh.hashnode.dev1 min read