Tap here to switch tabs
Problem
Submissions

Problem: Number of Distinct Islands

Number of Distinct Islands gives a binary grid of land and water. Return how many connected island shapes are unique, treating islands as identical only when they match 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 that are adjacent horizontally or vertically. Two islands are considered the same if one matches the other without rotating or flipping. The task is to return the number of distinct islands.

Constraints:

  • m == grid.length

  • n == grid[i].length

  • 1≤1 \leq m, n ≤100\leq100

  • grid[i][j] is either 00 or 11.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Number of Distinct Islands

Number of Distinct Islands gives a binary grid of land and water. Return how many connected island shapes are unique, treating islands as identical only when they match 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 that are adjacent horizontally or vertically. Two islands are considered the same if one matches the other without rotating or flipping. The task is to return the number of distinct islands.

Constraints:

  • m == grid.length

  • n == grid[i].length

  • 1≤1 \leq m, n ≤100\leq100

  • grid[i][j] is either 00 or 11.