当前位置:网站首页>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;
}
};
边栏推荐
- OpenMLDB Meetup No.4 会议纪要
- The sci-fi ideas in these movies have been realized by AI
- Cache avalanche and cache penetration solutions
- R language ggplot2 visualization: use ggplot2 visualization scatter diagram and the size parameter in AES function to specify the size of data points (point size)
- Set up your own website (13)
- 盘点那些具有特色的写作软件
- 缓存雪崩和缓存穿透解决方案
- Multiparty cardinality testing for threshold private set-2021: Interpretation
- 再不上市,旷视科技就熬不住了
- Alibaba cloud lifeifei: China's cloud database has taken the lead in many mainstream technological innovations abroad
猜你喜欢

wallys/3 × 3 MIMO 802.11ac Mini PCIe Wi-Fi Module, QCA9880, 2,4GHz / 5GHzDesigned for Enterprise

R language view version R package view version

MySQL 表的内连和外连

一个悄然崛起的国产软件,低调又强大!

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

Summer vacation study record

Dameng data rushes to the scientific innovation board, or becomes the "first share of domestic database" in the A-share market

How to analyze native crash through GDB

Alibaba cloud lifeifei: China's cloud database has taken the lead in many mainstream technological innovations abroad

Our company has used this set of general solutions for 7 years, and has opened up dozens of systems, a stable batch!
随机推荐
CVPR 2022 | greatly reduce the manual annotation required for zero sample learning. Mapu and Beiyou proposed category semantic embedding rich in visual information
用宝塔建第2个网站时网站总是报错:No input file specified.
Webview,ScrollView滑动冲突咋整
Our company has used this set of general solutions for 7 years, and has opened up dozens of systems, a stable batch!
wallys/600VX – 2 × 2 MIMO 802.11ac Mini PCIe Wi-Fi Module, Dual Band, 2,4GHz / 5GHz QCA 9880
goto语句跳转未初始化变量:C2362
Xu Lei expressed three thanks for the most difficult 618 in 19 years
R language ggplot2 visualization: use ggplot2 visualization scatter diagram and the color parameter in AES function to specify that data points in different groups are displayed in different colors
shell第一个命令结果传入第二个命令删除
Summer vacation study record
He was the first hero of Shanghai's two major industries, but died silently in regret
60 个神级 VS Code 插件!!
Database cascading operation
VScode选中多个单词
Limited time appointment | Apache pulsar Chinese developer and user group meeting in June
Global Capital Market 101:国内高净值人群最好的投资标的之一BREIT
盘点那些具有特色的写作软件
如何使用插件化机制优雅的封装你的请求hook
[revisiting the classic C language] ~x,%c,%d,%x, etc. in C language, the role of the address character in C language, and the consortium in C language
HMS core audio editing service 3D audio technology helps create an immersive auditory feast