当前位置:网站首页>695. maximum island area
695. maximum island area
2022-06-30 12:05:00 【Blueberry man】
And the number of islands is the same
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;
}
};
边栏推荐
- A high precision positioning approach for category support components with multiscale difference reading notes
- time 函数和 clock_gettime()函数的区别
- Multiparty cardinality testing for threshold private set-2021: Interpretation
- Typescript readonlyarray (read only array type) details
- R language ggplot2 visualization: use ggplot2 to visualize the scatter diagram, and_ Set show in the point parameter_ The legend parameter is false, and the legend information is not displayed
- A quietly rising domestic software, low-key and powerful!
- R语言ggplot2可视化分面图(facet):gganimate包基于transition_time函数创建动态散点图动画(gif)、使用labs函数为动画图添加动态时间标题
- "War" caused by a bottle of water
- 8253 counter introduction
- 1020. 飞地的数量
猜你喜欢

Limited time appointment | Apache pulsar Chinese developer and user group meeting in June

MySQL 复合查询

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

【模式识别大作业】

Summer vacation study record

来聊聊怎么做硬件兼容性检测,快速迁移到openEuler?

Quel est le rôle du rétroéclairage LED?

论文解读(AGC)《Attributed Graph Clustering via Adaptive Graph Convolution》

用于生成学习任务的量子神经网络2022最新综述

Another miserable day by kotlin grammar
随机推荐
【云原生 | Kubernetes篇】深入了解Deployment(八)
What is the function of LED backlight?
Getting started with the go language is simple: go handles XML files
Go zero micro Service Practice Series (VIII. How to handle tens of thousands of order requests per second)
R language ggplot2 visualization: use ggplot2 to visualize the scatter diagram and use scale_ x_ The log10 function configures the value range of the X axis to be logarithmic coordinates
Constructor, class member, destructor call order
爱可可AI前沿推介(6.30)
R语言ggplot2可视化:使用ggplot2可视化散点图、aes函数中的size参数指定数据点的大小(point size)
Quel est le rôle du rétroéclairage LED?
治数如治水,数据治理和数据创新难在哪?
R语言ggplot2可视化:使用ggplot2可视化散点图、在geom_point参数中设置alpha参数指定数据点的透明度级别(points transparent、从0到1)
Using cookie technology to realize historical browsing records and control the number of displays
限时预约|6 月 Apache Pulsar 中文开发者与用户组会议
Another miserable day by kotlin grammar
nvm安装node后,在使用npm指令时候显示不是内部或外部指令
VScode选中多个单词
自定义一个注解来获取数据库的链接
The first batch in China! Alibaba cloud native data Lake products have passed the evaluation and certification of the ICT Institute
STM32F407ZGT6使用SDIO方式驱动SD卡
Embedded SIG | 多 OS 混合部署框架