Back to course home
0% completed
Vote For New Content
can you please guide me how to solve this problem with iterative approach?
Sharafat Ali
Feb 7, 2023
can you please guide me how to solve this problem with iterative approach?
0
0
Comments
Comments
Shubham Voraa year ago
Here's the iterative version of the code using a queue for Breadth-First Search (BFS) instead of recursion:
from collections import deque class Solution: def hasCycle(self, matrix): rows = len(matrix) cols = len(matrix[0]) ...
On this page