Search⌘ K
AI Features

Solution: Number of Distinct Islands

Solution: Number of Distinct Islands gives a binary grid of land and water. Return how many islands connected horizontally or vertically have unique shapes. Rotations and flips count as different.

Statement

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