0% completed
The problem statement is incorrect based on the test cases.
Some Dude
Jul 27, 2023
The description states:
"An island is a connected set of 1s (land) and is surrounded by either an edge or 0s (water). Each cell is considered connected to other cells horizontally or vertically (not diagonally)."
Based on this definition, an island of [[1]] should not be an island, since it's not a set of connected 1s.
Ignoring that and pretending a single 1 is an island, the below test case has multiple singular islands, which violates the following:
"The given matrix has only one island, write a function to find the perimeter of that island."
[[0,1,0,1,0,1,0,1,0],[1,0,1,0,1,0,1,0,1],[0,1,0,1,0,1,0,1,0]]
So what's actually the expected behaviour here??
3
0
Comments
davemednikov 2 years ago
It's a shame that this has not been answered yet. I noticed the same thing with this specific test case. The expected answer does not reflect the given definitions of an island or matrix in the problem.
Shubham Voraa year ago
It is already fixed! We have removed the testcase.
On this page