当前位置:网站首页>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;
}
};
边栏推荐
- Go zero micro Service Practice Series (VIII. How to handle tens of thousands of order requests per second)
- 如何使用插件化机制优雅的封装你的请求hook
- Customize an annotation to get a link to the database
- Go 语言入门很简单:Go 处理 XML 文件
- 1020. 飞地的数量
- 聊聊怎么做硬件兼容性检测,快速迁移到openEuler?
- Another miserable day by kotlin grammar
- Let's talk about how to do hardware compatibility testing and quickly migrate to openeuler?
- R语言ggplot2可视化:使用ggplot2可视化散点图、使用scale_color_viridis_d函数指定数据点的配色方案
- led背光板的作用是什麼呢?
猜你喜欢

zabbix监控TCP连接个数

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

Boost study: boost log

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

MySQL 表的内连和外连

麒麟软件韩乃平:数字中国建设需要自己的开源根社区

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

wallys/600VX – 2×2 MIMO 802.11ac Mini PCIe Wi-Fi Module, Dual Band, 2,4GHz / 5GHz QCA 9880

STM32F407ZGT6使用SDIO方式驱动SD卡

What is the function of LED backlight?
随机推荐
R语言ggplot2可视化:使用ggplot2可视化散点图、使用scale_x_log10函数配置X轴的数值范围为对数坐标
695.最大岛屿面积
Shutter start from zero 006 radio switches and checkboxes
redis在项目中的使用
TypeScript ReadonlyArray(只读数组类型) 详细介绍
60 divine vs Code plug-ins!!
光谱共焦位移传感器的原理是什么?能应用那些领域?
HMS core audio editing service 3D audio technology helps create an immersive auditory feast
STM32F407ZGT6使用SDIO方式驱动SD卡
Webview,ScrollView滑动冲突咋整
1175. prime permutation
A High-Precision Positioning Approach for Catenary Support Components With Multiscale Difference阅读笔记
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
Flutter 从零开始 006 单选开关和复选框
MySQL 表的内连和外连
The sci-fi ideas in these movies have been realized by AI
R language ggplot2 visualization: gganimate package is based on Transition_ The time function creates a dynamic scatter graph animation (GIF), and uses the labs function to add a dynamic time title to
Multiparty cardinality testing for threshold private set-2021: Interpretation
谁还记得「张同学」?
智慧法院新征程,无纸化办公,护航智慧法院绿色庭审