You are given an m x n binary grid grid where:
1
represents land
0
represents water
Return the number of islands in the grid.
Constraint: You must solve it using BFS, and you are not allowed to modify grid in-place (e.g., you cannot flip visited 1s to 0s).
Two islands are considered the same shape if one can be translated (shifted up/down/left/right) to match the other exactly (rotations/reflections do not count unless explicitly stated).
Return the number of distinct island shapes in the grid.
grid: List[List[int]]
1 <= m, n <= 200
(or similar)
O(mn)