当前位置:网站首页>695.最大岛屿面积
695.最大岛屿面积
2022-06-30 11:41:00 【蓝莓侠】
和岛数量是一样的
class Solution {
public:
int g_max_large = 0;
void get_max_large(vector<vector<int>>&a,int x, int y)
{
if(x<0 || x>=(int)a.size() || y<0 || y>=(int)a[0].size())
return;
if(a[x][y]==1)
{
a[x][y]=2;
++g_max_large;
get_max_large(a,x-1,y);
get_max_large(a,x+1,y);
get_max_large(a,x,y-1);
get_max_large(a,x,y+1);
}
}
int maxAreaOfIsland(vector<vector<int>> & a)
{
int max_large = 0;
for(int i=0; i<(int)a.size();i++)
{
for(int j=0; j<(int)a[0].size();j++)
{
g_max_large = 0;
get_max_large(a,i,j);
max_large = max(g_max_large, max_large);
}
}
return max_large;
}
};
边栏推荐
- The first batch in China! Alibaba cloud native data Lake products have passed the evaluation and certification of the ICT Institute
- Stm32f407zgt6 uses SDIO mode to drive SD card
- VScode选中多个单词
- 【重温经典C语言】~c语言中%x、%c、%d、%x等等等、c语言取地址符&的作用、C语言中的 联合体
- Constructor, class member, destructor call order
- Oracle netsuite helps TCM bio understand data changes and make business development more flexible
- Redis - SDS simple dynamic string
- Yolov5 export the pit encountered by onnx
- c# 怎样能写个sql的解析器
- STM32F407ZGT6使用SDIO方式驱动SD卡
猜你喜欢

It is said that with this, the boss opened the test overnight

如何使用插件化机制优雅的封装你的请求hook

Our company has used this set of general solutions for 7 years, and has opened up dozens of systems, a stable batch!

In depth analysis of Apache bookkeeper series: Part 4 - back pressure

60 个神级 VS Code 插件!!

盘点那些具有特色的写作软件

He was the first hero of Shanghai's two major industries, but died silently in regret
![[pattern recognition]](/img/b1/dcb444cbf40a43eeb7f7b233d7741a.png)
[pattern recognition]

nvm安装node后,在使用npm指令时候显示不是内部或外部指令

治数如治水,数据治理和数据创新难在哪?
随机推荐
The first batch in China! Alibaba cloud native data Lake products have passed the evaluation and certification of the ICT Institute
Database transactions
Win10 R package installation error: not installed in arch=i386
Who still remembers "classmate Zhang"?
Multiparty cardinality testing for threshold private set-2021: Interpretation
Cache avalanche and cache penetration solutions
In depth analysis of Apache bookkeeper series: Part 4 - back pressure
1175. 质数排列 : 乘法原理运用题
数据库 级联操作
"War" caused by a bottle of water
Analysis of KOA - onion model
Limited time appointment | Apache pulsar Chinese developer and user group meeting in June
Global Capital Market 101:国内高净值人群最好的投资标的之一BREIT
Goto statement jump uninitialized variable: c2362
MySQL 复合查询
Alibaba cloud lifeifei: China's cloud database has taken the lead in many mainstream technological innovations abroad
Typescript readonlyarray (read only array type) details
R语言ggplot2可视化:使用ggplot2可视化散点图、在geom_point参数中设置show_legend参数为FALSE配置不显示图例信息
Another miserable day by kotlin grammar
"New digital technology" completed tens of millions of yuan of a + round financing and built an integrated intelligent database cloud management platform