Skip to content

Commit d052b88

Browse files
committed
fix: Ensure is_safe() returns boolean instead of int
Previously, is_safe() could return the value of a cell (int 1 or 0), which caused test failures. This fix ensures that is_safe() returns True if the cell is safe to visit and False otherwise
1 parent 3244ef9 commit d052b88

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

matrix/count_islands_in_matrix.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def is_safe(self, i: int, j: int, visited: list[list[bool]]) -> bool:
8787
0 <= i < self.ROW
8888
and 0 <= j < self.COL
8989
and not visited[i][j]
90-
and self.graph[i][j]
90+
and self.graph[i][j] == 1
9191
)
9292

9393
def diffs(self, i: int, j: int, visited: list[list[bool]]) -> None:

0 commit comments

Comments
 (0)