MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / is_safe

Method is_safe

matrix/count_islands_in_matrix.py:12–18  ·  view source on GitHub ↗
(self, i: int, j: int, visited: list[list[bool]])

Source from the content-addressed store, hash-verified

10 self.graph = graph
11
12 def is_safe(self, i: int, j: int, visited: list[list[bool]]) -> bool:
13 return (
14 0 <= i < self.ROW
15 and 0 <= j < self.COL
16 and not visited[i][j]
17 and self.graph[i][j]
18 )
19
20 def diffs(self, i: int, j: int, visited: list[list[bool]]) -> None:
21 # Checking all 8 elements surrounding nth element

Callers 1

diffsMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected