Grokking Graph Algorithms for Coding Interviews
Ask Author
Back to course home

0% completed

Vote For New Content
BFS examples seem to be missing on this problem, any plans to add them in as it ...

Alan Ross

Oct 13, 2022

BFS examples seem to be missing on this problem, any plans to add them in as it is mentioned?

2

0

Comments
Comments
B
Becca 3 years ago

Agreed, would definitely be useful to see the BFS implementation of this problem here!

A
Alfonso Vieyra2 years ago

Hello! This is my BFS solution for what its worth:

    def bfs(i: int, j: int)->int:       from collections import deque       directions = [(1,0), (-1, 0), (0, 1), (0, -1)]       q = deque()       q.append((i, j))       matrix[i][j] = 0       islandSize = 1

      whi...

On this page