Back to problems

Number of Islands with Diagonal Connectivity

Algorithm · Google · Medium

Number of Islands Including Diagonals Medium · Topics · Company Tags · Hints You are given an $$m \times n$$ binary grid grid where each cell contains either '1' (land) or '0' (water). An island is a group of connected land cells. Two land cells are connected if they are adjacent in any of the eight possible directions: left, right, up, down, and the four diagonals. In other words, a cell can move one step to any of its surrounding eight neighbors. Compute and return the…

Checking your access…