This commit is contained in:
youngyangyang04
2025-07-06 11:26:06 +08:00
parent e957225f4a
commit 7aa973b561
39 changed files with 127 additions and 100 deletions

View File

@@ -50,6 +50,8 @@
## 思路
**[《代码随想录》算法视频公开课](https://programmercarl.com/other/gongkaike.html)[图论:岛屿问题上难度了! |深搜优先搜索DFS | 广度优先搜索BFS | 卡码网104.建造最大岛屿](https://www.bilibili.com/video/BV1Dn5CzZEw1/),相信结合视频再看本篇题解,更有助于大家对本题的理解**。
本题的一个暴力想法,应该是遍历地图尝试 将每一个 0 改成1然后去搜索地图中的最大的岛屿面积。
计算地图的最大面积:遍历地图 + 深搜岛屿,时间复杂度为 n * n。
@@ -663,4 +665,3 @@ const dfs = (graph, visited, x, y, mark) => {
### C
<div align="center"><a href="https://www.nowcoder.com/link/wx_sqlcarl199" target="_blank"><img src="https://code-thinking-1253855093.file.myqcloud.com/pics/20220416223343.png" width="1000"/></a></div>