Search⌘ K
AI Features

Solution: Number of Distinct Islands

Solution: Number of Distinct Islands asks you to inspect a binary grid, group connected land cells by horizontal or vertical adjacency, and count distinct island shapes without rotation or flipping.

Statement

Given an m x n binary matrix where 11 represents land and 00 represents water. An island is a group of connected 1s1s ...