原文:Leetcode: Number of Islands

DFS的Flood Fill方法, 不使用额外visited数组,但是用 变成 表示visited的方法 复杂度 时间 O NM 空间 O max N,M 递归栈空间 Union Find: Quick Union follow up是找最大岛的面积,想法是设置两个全局变量 maxArea, area, area负责记录每个岛的面积,上面代码第 行每次遇到 就置为 ,然后在recursion里面 ...

2015-04-11 05:20 0 1999 推荐指数:

查看详情

[LeetCode] Number of Islands

Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting ...

Wed Apr 08 20:37:00 CST 2015 0 2918
[LeetCode] Number of Islands II

Problem Description: A 2d grid map of m rows and n columns is initially filled with water. We may p ...

Sun Nov 15 04:55:00 CST 2015 0 6974
 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM