leetcode 695 Max Area of Island
来源:互联网 发布:剑网三重制版 知乎 编辑:程序博客网 时间:2024/05/16 12:06
class Solution { public int maxAreaOfIsland(int[][] grid) { int max_air=0; for(int i=0;i<grid.length;i++){ for(int j=0;j<grid[0].length;j++){ if(grid[i][j]==1) max_air=Math.max(max_air,maxair(grid,i,j)); } } return max_air; } public int maxair(int[][] grid,int i,int j){ if(i >=0 && i<grid.length && j>=0 && j<grid[0].length && grid[i][j]==1){ grid[i][j]=0; return 1+maxair(grid,i+1,j)+maxair(grid,i-1,j)+maxair(grid,i,j+1)+maxair(grid,i,j-1); } return 0; } }
阅读全文
0 0
- leetcode 695(Max Area of Island)
- leetcode 695 Max Area of Island
- LeetCode: Max Area of Island
- Max Area of Island(leetcode)
- leetCode-Max Area of Island
- 695 Max Area of Island
- Leetcode第695题. Max Area of Island
- leetcode 695. Max Area of Island 解法
- [LeetCode] Algorithms-695. Max Area of Island
- Leetcode 695. Max Area of Island
- LeetCode-695. Max Area of Island
- LeetCode 695. Max Area of Island
- LeetCode-695. Max Area of Island
- [LeetCode] 695. Max Area of Island
- 【LeetCode】695. Max Area of Island
- 695. Max Area of Island
- 695. Max Area of Island
- 695. Max Area of Island
- cocos2dx定时器的用法
- 关于Service的一些理解
- 第四周项目二
- nginx配置的优化
- 一些自己看过的链接(持续更新)
- leetcode 695 Max Area of Island
- 给定索引k,返回Pascal三角形的第k行。例如,给定k = 3,返回[1,3,3,1]。
- 由Instant Run引发的问题及其解决方案
- IntelliJ IDEA安装使用
- 平衡二叉树
- Qt 双缓冲绘图
- 算法入门题
- 东方数智发布新品AIDOL,打造人工智能偶像全息平台
- 第7周项目1