You are given a 2D grid representing a map of land cells (represented by 1s) and water cells (represented by 0s). Determine the total number of distinct islands.
An island is formed by connecting adjacent land cells horizontally or vertically. You may assume that all four edges of the grid are completely surrounded by water.
Visualizer will appear here