diff --git a/matrix/count_islands_in_matrix.py b/matrix/count_islands_in_matrix.py index 393b4c53f..9eb83f4c3 100644 --- a/matrix/count_islands_in_matrix.py +++ b/matrix/count_islands_in_matrix.py @@ -92,7 +92,7 @@ class Matrix: # Public class to implement a graph count = 0 for i in range(self.ROW): for j in range(self.COL): - if visited[i][j] is False and self.graph[i][j]: + if visited[i][j] is False and self.graph[i][j] == 1: self.diffs(i, j, visited) count += 1 return count