当前位置:网站首页>[to be continued] [depth first search] 547 Number of provinces
[to be continued] [depth first search] 547 Number of provinces
2022-07-05 05:16:00 【lee2813】
One 、 subject
Yes n Cities , Some of them are connected to each other , Others are not connected . If the city a And the city b Direct connection , And the city b And the city c Direct connection , So the city a And the city c Indirectly connected .
Province It's a group of directly or indirectly connected cities , There are no other cities in the group that are not connected .
To give you one n x n Matrix isConnected , among isConnected[i][j] = 1 It means the first one i Two cities and j The two cities are directly connected , and isConnected[i][j] = 0 The two are not directly connected .
Back in the matrix Province The number of .
Example 1:
Input :isConnected = [[1,1,0],[1,1,0],[0,0,1]]
Output :2
Example 2:
Input :isConnected = [[1,0,0],[0,1,0],[0,0,1]]
Output :3
Two 、 Answer key
3、 ... and 、 Code
边栏推荐
- 质量体系建设之路的分分合合
- The present is a gift from heaven -- a film review of the journey of the soul
- 3dsmax snaps to frozen objects
- Cocos2dx Lua registers the touch event and detects whether the click coordinates are within the specified area
- 3dsmax2018 common operations and some shortcut keys of editable polygons
- Research on the value of background repeat of background tiling
- The next key of win generates the timestamp file of the current day
- Pause and resume of cocos2dx Lua scenario
- [paper notes] multi goal reinforcement learning: challenging robotics environments and request for research
- A complete attack chain
猜你喜欢

【论文笔记】Multi-Goal Reinforcement Learning: Challenging Robotics Environments and Request for Research

Unity parallax infinite scrolling background

质量体系建设之路的分分合合
![[paper notes] multi goal reinforcement learning: challenging robotics environments and request for research](/img/17/db8614b177f33ee4f67b7d65a8430f.png)
[paper notes] multi goal reinforcement learning: challenging robotics environments and request for research

Stm32cubemx (8): RTC and RTC wake-up interrupt

《动手学深度学习》学习笔记

Unity get component

Do a small pressure test with JMeter tool
![[轉]: OSGI規範 深入淺出](/img/54/d73a8d3e375dfe430c2eca39617b9c.png)
[轉]: OSGI規範 深入淺出

Page countdown
随机推荐
Insert sort
支持多模多态 GBase 8c数据库持续创新重磅升级
[paper notes] multi goal reinforcement learning: challenging robotics environments and request for research
JVM call not used once in ten years
Chinese notes of unit particle system particle effect
2022上半年全国教师资格证下
[转]: OSGI规范 深入浅出
Cocos create Jiugongge pictures
Cocos progress bar progresstimer
Generate filled text and pictures
Applet live + e-commerce, if you want to be a new retail e-commerce, use it!
3dsmax snaps to frozen objects
TF-A中的工具介绍
[allocation problem] 455 Distribute cookies
嵌入式数据库开发编程(零)
stm32Cubemx(8):RTC和RTC唤醒中断
Applet Live + e - commerce, si vous voulez être un nouveau e - commerce de détail, utilisez - le!
UE4/UE5 虚幻引擎,材质篇(三),不同距离的材质优化
Lua determines whether the current time is the time of the day
[interval problem] 435 Non overlapping interval