Algorithm · Google · Medium
In a grid representing an ocean, 1 marks land and 0 marks water. Count the number of distinct island shapes, treating rotations and mirror reflections as disallowed when comparing shapes. Cells belong to the same island when they share an edge, meaning connections are only horizontal or vertical. Function Description Implement the function numDistinctIslands in the editor. The function accepts the following parameter: int[][] grid: a two-dimensional integer array describing…
Checking your access…