Given an m x n binary matrix where 1 represents land and 0 represents water. An island is a group of connected 1s 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≤ m, n ...