Leetcode 934. Shortest Bridge - DFS and multi-source BFS
Автор: Code-Yao
Загружено: 2022-08-11
Просмотров: 147
Описание:
See other videos @codeyao9796
Python traversal solutions to Leetcode 934 - Shortest Bridge. As this problem is required to find shortest "distance" of one island towards another, we first use DFS to locate one islands, then use multi-source BFS to find the distance. Two points to be noticed for the solution presented here are: (1) we do BFS expansion from the outer water boundary of one island; (2) we change visited grid land cell to having value -1 to avoid repetition.
Повторяем попытку...
Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: