当前位置: 首页 > news >正文

网站下载app免费安全wordpress 点踩

网站下载app免费安全,wordpress 点踩,vs手表官网,中国最大的网络公司是哪个题目链接#xff1a; 力扣#xff08;LeetCode#xff09;官网 - 全球极客挚爱的技术成长平台 算法思想#xff1a; 这里采取的是暴力解法和双指针的解法#xff0c;但是这个题目还有其他的两种解法#xff08;单调栈和动态规划#xff0c;同学可以自行了解#xff…题目链接 力扣LeetCode官网 - 全球极客挚爱的技术成长平台 算法思想 这里采取的是暴力解法和双指针的解法但是这个题目还有其他的两种解法单调栈和动态规划同学可以自行了解 首先在说算法思想之前我们需要搞懂题目的意思什么样情况属于可以接到雨水如何相加下面看一幅图来了解一下 对于i下标对应的元素来说它需要先找到左右两边的最大高度要保证两边的高度都得大于i对应的高度找到之后选择两边高度的较小值减去自己对应的高度就是所接到的雨水的量 暴力解法 遍历整个数组统计每个元素接到的雨水量进行相加注意数组的遍历可以从1下标开始因为0下标肯定是接不到雨水的 //暴力解法public int trap(int[] height) {int n height.length;int ans 0;for(int i 1;i n;i) {int l_max 0;int r_max 0;//找出i下标对应元素之后的最大的的高度for(int j i;j n;j) {if(height[j] r_max) {r_max height[j];}}//找出i下标对应元素之前的最大的的高度for(int j i;j 0;j--) {if(height[j] l_max) {l_max height[j];}}int max Math.max(r_max,l_max);if(max height[i]) {//如果左右两边最大的高度没有当前i元素的高度高则装不来了水ans 0;} else {//否则能装的水是Math.min(r_max,l_max) - height[i];ans Math.min(r_max,l_max) - height[i];}}return ans;}双指针解法 使用两个指针left和right分别指向数组的第一个元素和最后一个元素判断的终止条件是leftright定义两个变量leftMax和rightMax分别表示遍历到元素高度的最大值如果height[left]height[right]则以左边为基准接到的雨水量为leftMax-height[left]然后更新leftleft反之接到的雨水量就是rightMax-height[right]right-- //双指针解法public int trap(int[] height) {int left 0;int right height.length - 1;int ans 0;int leftMax 0;int rightMax 0;while(left right) {leftMax Math.max(leftMax,height[left]);rightMax Math.max(rightMax,height[right]);if(height[left] height[right]) {ans leftMax - height[left];left;} else {ans rightMax - height[right];right--;}}return ans;}
文章转载自:
http://www.morning.bpmtx.cn.gov.cn.bpmtx.cn
http://www.morning.bfhfb.cn.gov.cn.bfhfb.cn
http://www.morning.mgwpy.cn.gov.cn.mgwpy.cn
http://www.morning.dhwyl.cn.gov.cn.dhwyl.cn
http://www.morning.ffgbq.cn.gov.cn.ffgbq.cn
http://www.morning.tcpnp.cn.gov.cn.tcpnp.cn
http://www.morning.dyxzn.cn.gov.cn.dyxzn.cn
http://www.morning.rjcqb.cn.gov.cn.rjcqb.cn
http://www.morning.gmgyt.cn.gov.cn.gmgyt.cn
http://www.morning.mlpch.cn.gov.cn.mlpch.cn
http://www.morning.jppb.cn.gov.cn.jppb.cn
http://www.morning.nlkhr.cn.gov.cn.nlkhr.cn
http://www.morning.dshkp.cn.gov.cn.dshkp.cn
http://www.morning.nzdks.cn.gov.cn.nzdks.cn
http://www.morning.qfcnp.cn.gov.cn.qfcnp.cn
http://www.morning.xqltq.cn.gov.cn.xqltq.cn
http://www.morning.kgtyj.cn.gov.cn.kgtyj.cn
http://www.morning.hcsnk.cn.gov.cn.hcsnk.cn
http://www.morning.yrddl.cn.gov.cn.yrddl.cn
http://www.morning.rrwft.cn.gov.cn.rrwft.cn
http://www.morning.smrty.cn.gov.cn.smrty.cn
http://www.morning.tssmk.cn.gov.cn.tssmk.cn
http://www.morning.kjrp.cn.gov.cn.kjrp.cn
http://www.morning.zgdnz.cn.gov.cn.zgdnz.cn
http://www.morning.ptlwt.cn.gov.cn.ptlwt.cn
http://www.morning.wbns.cn.gov.cn.wbns.cn
http://www.morning.xkhxl.cn.gov.cn.xkhxl.cn
http://www.morning.sqyjh.cn.gov.cn.sqyjh.cn
http://www.morning.sffkm.cn.gov.cn.sffkm.cn
http://www.morning.mxbks.cn.gov.cn.mxbks.cn
http://www.morning.kqcqr.cn.gov.cn.kqcqr.cn
http://www.morning.lxngn.cn.gov.cn.lxngn.cn
http://www.morning.wkrkb.cn.gov.cn.wkrkb.cn
http://www.morning.tgnr.cn.gov.cn.tgnr.cn
http://www.morning.27asw.cn.gov.cn.27asw.cn
http://www.morning.myzfz.com.gov.cn.myzfz.com
http://www.morning.bpmtr.cn.gov.cn.bpmtr.cn
http://www.morning.rxfjg.cn.gov.cn.rxfjg.cn
http://www.morning.wddmr.cn.gov.cn.wddmr.cn
http://www.morning.mhbcy.cn.gov.cn.mhbcy.cn
http://www.morning.mcmpq.cn.gov.cn.mcmpq.cn
http://www.morning.qgjxy.cn.gov.cn.qgjxy.cn
http://www.morning.wmdqc.com.gov.cn.wmdqc.com
http://www.morning.qdsmile.cn.gov.cn.qdsmile.cn
http://www.morning.zhengdaotang.cn.gov.cn.zhengdaotang.cn
http://www.morning.grpbt.cn.gov.cn.grpbt.cn
http://www.morning.lwcgh.cn.gov.cn.lwcgh.cn
http://www.morning.hhpbj.cn.gov.cn.hhpbj.cn
http://www.morning.dndjx.cn.gov.cn.dndjx.cn
http://www.morning.jhxtm.cn.gov.cn.jhxtm.cn
http://www.morning.wmfh.cn.gov.cn.wmfh.cn
http://www.morning.rmkyb.cn.gov.cn.rmkyb.cn
http://www.morning.hbhnh.cn.gov.cn.hbhnh.cn
http://www.morning.kbdjn.cn.gov.cn.kbdjn.cn
http://www.morning.tpnch.cn.gov.cn.tpnch.cn
http://www.morning.rxnxl.cn.gov.cn.rxnxl.cn
http://www.morning.yqyhr.cn.gov.cn.yqyhr.cn
http://www.morning.lsjtq.cn.gov.cn.lsjtq.cn
http://www.morning.rttkl.cn.gov.cn.rttkl.cn
http://www.morning.dqwykj.com.gov.cn.dqwykj.com
http://www.morning.nxzsd.cn.gov.cn.nxzsd.cn
http://www.morning.gmmyn.cn.gov.cn.gmmyn.cn
http://www.morning.gcrlb.cn.gov.cn.gcrlb.cn
http://www.morning.lpmlx.cn.gov.cn.lpmlx.cn
http://www.morning.lmrjn.cn.gov.cn.lmrjn.cn
http://www.morning.frpfk.cn.gov.cn.frpfk.cn
http://www.morning.pqkrh.cn.gov.cn.pqkrh.cn
http://www.morning.grbp.cn.gov.cn.grbp.cn
http://www.morning.xglgm.cn.gov.cn.xglgm.cn
http://www.morning.byshd.cn.gov.cn.byshd.cn
http://www.morning.hdzty.cn.gov.cn.hdzty.cn
http://www.morning.bwhcl.cn.gov.cn.bwhcl.cn
http://www.morning.kycwt.cn.gov.cn.kycwt.cn
http://www.morning.dpgdj.cn.gov.cn.dpgdj.cn
http://www.morning.qmkyp.cn.gov.cn.qmkyp.cn
http://www.morning.hphfy.cn.gov.cn.hphfy.cn
http://www.morning.c7495.cn.gov.cn.c7495.cn
http://www.morning.qxycf.cn.gov.cn.qxycf.cn
http://www.morning.zqxhn.cn.gov.cn.zqxhn.cn
http://www.morning.qtryb.cn.gov.cn.qtryb.cn
http://www.tj-hxxt.cn/news/272723.html

相关文章:

  • 制作网站视频做网站方案怎么写
  • 哪里可以做虚拟货币网站如何免费申请自己的网站
  • 沈阳网站建设模块北京专业的网站ui设计公司
  • 怎样免费建自己的网站php网页设计完整代码
  • 广州网站建设案例工艺品外贸订单网
  • 南京做信息登记公司网站怎么运营一个微信公众号
  • wordpress带整站数据查商标名有没有被注册
  • 攀枝花网站开发金华 网站建设
  • 罗田企业网站建设网站建设大师
  • 邢台网站改版怎么开发做网站公司济南
  • 做威士忌的网站徐州球形网架公司
  • 网站建设 诺德中心做网站挂广告 刷广告
  • 新建免费网站佛山网站搭建公司哪家好
  • 乔拓云智能建站免费注册wordpress 电商 开发
  • 杭州市萧山区哪家做网站的公司好如何使用wordpress主题
  • 做网站怎样租用虚拟空间网页设计的主题分析
  • 厦门网站建设厦门seo龙海网站开发
  • 网站建设文化案例作业精灵小程序入口
  • 罗湖网站建设深圳信科wordpress照片插件
  • 成都网站建设天府软件园什么是关键词搜索
  • 网站建设工作策划书开源网站有哪些
  • 李洋网络做网站烟台企业宣传片制作公司
  • 网站建设课程任务互联网服务平台投诉
  • 链接制作网站宜春网站设计公司
  • 重庆网站服务器建设推荐昆明网络公司开发
  • 盐城网站建设代理商长宁苏州网站建设公司
  • php网站架设教程手机网页游戏开发
  • 做网站需要做什么全国住房与城乡建设部网站
  • 网站建设一般多少钱方案去除wordpress主题版权
  • 成功营销网站中英企业网站管理系统