【文件属性】:
文件名称:陆地岛屿问题leetcode-number-of-distinct-islands:计算不同岛屿的数量
文件大小:6KB
文件格式:ZIP
更新时间:2021-07-06 19:57:48
系统开源
狼人问题leetcode
不同岛屿的数量
给定一个由
0
和
1
组成的非空
2D
阵列网格,岛是一组
1(代表陆地)以
4
个方向(水平或垂直)连接。您可以假设网格的所有四个边缘都被水包围。
计算不同岛屿的数量。
当且仅当一个岛可以平移(而不是旋转或反射)以与另一个岛相等时,才认为一个岛与另一个岛相同。
Example
1:
11000
11000
00011
00011
Given
the
above
grid
map,
return
1.
Example
2:
11011
10000
00001
11011
Given
the
above
grid
map,
return
3.
Notice
that:
11
1
and
1
11
are
considered
different
island
shapes,
because
we
do
not
consider
reflection
/
rotation.
注意:给定网格中每个维度的长度不超过
50。
错误的实施:
class
Solution
{
public
int
numDistinctIslands
(
int
[][]
【文件预览】:
number-of-distinct-islands-master
----island-shape-1.JPG(8KB)
----README.md(5KB)
----island-shape-2.JPG(8KB)