君不见长松卧壑困风霜,时来屹立扶明堂。这篇文章主要讲述leetcode407 Trapping rain water II相关的知识,希望能为你提供帮助。
use 3D version to calculate how much water the model can contain
this problem need use dfs,from the edge part which mustn‘t be answer,for the edge cannot contain water,so push these edge part into queue first.because we need dfs blocks from the lower part to the higher,so need special priority_queue greater type,we can grep block from lower to higher.
MAIN THOUGHT:
the main thought is sea level,use an increasing value represent sea level,
a queue store the block been visited
STORE TOOL:
priority_queue<
pair<
int,int>
,greater>
vector<
vector<
bool>
>
visited
sea [record now sea level height]
res [record total answer]
ATTENTION:
initialize vector use = or directly follow {} also can be.
priority_queue need use push,if push type pair<
int,int>
need use {} wrap two value
【leetcode407 Trapping rain water II】
推荐阅读
- android 二级列表 二级目录
- vue+uni-app商城实战 | 第一篇(有来小店微信小程序快速开发接入Spring Cloud OAuth2认证中心完成授权登录)
- cnpm : 无法加载文件 C:UsersadminAppDataRoamingpmcnpm.ps1,因为在此系统上禁止运行脚本。有关详细信息 hbuilderx
- 用华为HMS ML kit人体骨骼识别技术,Android快速实现人体姿势动作抓拍
- 了解Android_04之EditText标签
- 在Android中如果在非UI线程更新UI会抛出异常
- 多测师讲解 ---面试课程之app_001---高级讲师肖sir
- 多测师讲解 app---面试课程之复习(003)---高级讲师肖sir
- 记一次bug:C:Users98426.gradlecaches ransforms-1files-1.1appcompat-v7-28.0.0.aare5d207ddf888a313