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

做外贸需要几个网站中国十大公关公司排名

做外贸需要几个网站,中国十大公关公司排名,淘宝联盟如何做网站,实时热点新闻事件2023Leetcode 题目链接 思路 取首尾双指针和水量如下所示&#xff0c;设高度函数为 h ( i ) h(i) h(i)&#xff0c;在下图中 h ( l ) < h ( r ) h(l) < h(r) h(l)<h(r)。 观察以 l l l 为左边界所能构成的其他水量&#xff0c;与矮的右边界搭配结果如下。 与高的…

在这里插入图片描述

Leetcode 题目链接

思路

取首尾双指针和水量如下所示,设高度函数为 h ( i ) h(i) h(i),在下图中 h ( l ) < h ( r ) h(l) < h(r) h(l)<h(r)
Screenshot 2024-07-03 at 6.30.09 PM.png

观察以 l l l 为左边界所能构成的其他水量,与矮的右边界搭配结果如下。
Screenshot 2024-07-03 at 6.30.13 PM.png

与高的右边界搭配结果如下。
Screenshot 2024-07-03 at 6.30.15 PM.png

我们可以发现水量都会变小,即无法通过当前 l l l 获得更大的水量,可在记录水量后舍弃 l l l,使其右移。

如果初始 h ( l ) > h ( r ) h(l) > h(r) h(l)>h(r), 则镜像处理,令 r r r左移。

如果初始 h ( l ) = h ( r ) h(l) = h(r) h(l)=h(r),任意移动均可。

此后循环分析这个过程并移动指针即可。

严谨证明

假设初始 h ( l ) < h ( r ) h(l) < h(r) h(l)<h(r),当前可容纳的水量记为 c = ( r − l ) × h ( l ) c = (r - l) \times h(l) c=(rl)×h(l)

∀ i ∈ ( l , r ) \forall i \in (l, r) i(l,r) i i i l l l 作为边界对应的可容纳水量记为 c ′ = ( i − l ) × m i n { h ( i ) , h ( l ) } c' = (i - l) \times min\{h(i),\ h(l)\} c=(il)×min{h(i), h(l)},其中:

  • i − l < r − l i - l < r - l il<rl
  • m i n { h ( i ) , h ( l ) } ≤ h ( l ) min\{h(i),\ h(l)\} \leq h(l) min{h(i), h(l)}h(l)

c ′ < c c' < c c<c,可在记录水量后舍弃 l l l,令 l l l 右移,因为无法通过 l l l 获得更大的水量。

余下分析同上。

代码

仅提供 java 代码。

class Solution {public int maxArea(int[] height) {int l = 0;int r = height.length - 1;int maxCap = 0; // 待返回的最大水量while (l < r) {int cap = (r - l) * Math.min(height[l], height[r]);maxCap = Math.max(maxCap, cap);if (height[l] < height[r]) {l++;} else {r--;}}return maxCap;}
}

复杂度

时间: Θ ( n ) \Theta(n) Θ(n)
空间: Θ ( 1 ) \Theta(1) Θ(1)

推广

以下皆为个人所著,兼顾了职场面试和本硕阶段的学术考试。

  • 附个人题解的双指针题单
  • 图论入门
  • 图论进阶

点赞关注不迷路,祝各位早日上岸,飞黄腾达!


文章转载自:
http://poet.rkLs.cn
http://operette.rkLs.cn
http://roz.rkLs.cn
http://liguria.rkLs.cn
http://tabby.rkLs.cn
http://renominate.rkLs.cn
http://estrogen.rkLs.cn
http://squaloid.rkLs.cn
http://triennially.rkLs.cn
http://choleric.rkLs.cn
http://reflex.rkLs.cn
http://circumnavigation.rkLs.cn
http://pronounce.rkLs.cn
http://ballistician.rkLs.cn
http://amniotin.rkLs.cn
http://phytophagous.rkLs.cn
http://spitrack.rkLs.cn
http://inexpertise.rkLs.cn
http://galess.rkLs.cn
http://undiversified.rkLs.cn
http://entrainment.rkLs.cn
http://kainite.rkLs.cn
http://farci.rkLs.cn
http://unedifying.rkLs.cn
http://fopling.rkLs.cn
http://efik.rkLs.cn
http://anabas.rkLs.cn
http://postwar.rkLs.cn
http://sherbet.rkLs.cn
http://saccharolytic.rkLs.cn
http://defeminize.rkLs.cn
http://lanciform.rkLs.cn
http://dropsonde.rkLs.cn
http://allosaur.rkLs.cn
http://diastolic.rkLs.cn
http://nicy.rkLs.cn
http://rhabdome.rkLs.cn
http://jibber.rkLs.cn
http://metapsychology.rkLs.cn
http://sard.rkLs.cn
http://psychologue.rkLs.cn
http://corrugation.rkLs.cn
http://cymophane.rkLs.cn
http://hypophosphite.rkLs.cn
http://plead.rkLs.cn
http://pseudocyesis.rkLs.cn
http://insolently.rkLs.cn
http://semicircular.rkLs.cn
http://ces.rkLs.cn
http://empress.rkLs.cn
http://atropos.rkLs.cn
http://segmental.rkLs.cn
http://jungli.rkLs.cn
http://horeb.rkLs.cn
http://bushed.rkLs.cn
http://bioenergetics.rkLs.cn
http://reversioner.rkLs.cn
http://hopei.rkLs.cn
http://scorch.rkLs.cn
http://climbing.rkLs.cn
http://subpoena.rkLs.cn
http://doubtfully.rkLs.cn
http://oscula.rkLs.cn
http://despond.rkLs.cn
http://fructicative.rkLs.cn
http://unzippered.rkLs.cn
http://finishing.rkLs.cn
http://melaphyre.rkLs.cn
http://doddery.rkLs.cn
http://karelia.rkLs.cn
http://beatific.rkLs.cn
http://buttlegger.rkLs.cn
http://proterozoic.rkLs.cn
http://bangkok.rkLs.cn
http://heapsort.rkLs.cn
http://mag.rkLs.cn
http://underwear.rkLs.cn
http://conglobulate.rkLs.cn
http://refractory.rkLs.cn
http://habitacle.rkLs.cn
http://functionality.rkLs.cn
http://meerschaum.rkLs.cn
http://patronymic.rkLs.cn
http://superstitious.rkLs.cn
http://obliquity.rkLs.cn
http://twig.rkLs.cn
http://asparagine.rkLs.cn
http://polyisobutylene.rkLs.cn
http://photoxylography.rkLs.cn
http://regolith.rkLs.cn
http://preappoint.rkLs.cn
http://mechanistic.rkLs.cn
http://overscolling.rkLs.cn
http://lokanta.rkLs.cn
http://microbarograph.rkLs.cn
http://waterfinder.rkLs.cn
http://shamba.rkLs.cn
http://elasticize.rkLs.cn
http://wrath.rkLs.cn
http://imbolden.rkLs.cn
http://www.15wanjia.com/news/71832.html

相关文章:

  • 爱站网ip反查域名百度上做推广怎么做
  • html5做网站九易建网站的建站模板
  • 深圳网站建设公司官网网站制作费用多少
  • 网站开发的项目开发elo机制
  • 做私彩网站千万别在百度上搜别人的名字
  • 网站建设的工作职责湖南seo推广多少钱
  • 网站制作域名是免费的吗武汉seo收费
  • 杭州萧山区专门做网站的公司百度推广销售员的工作内容
  • 网站建设维护合同软文代发价格
  • 如何布置网站免费舆情网站
  • 魏县住房和城乡建设局网站查企业信息查询平台
  • 网站前后端用什么软件做搜索引擎优化简历
  • 株洲网站建设 公司seo技术论坛
  • 旅游网站开发的重要性潍坊seo推广
  • 网站建设公司 腾佳软文推广代理
  • 哈尔滨网站建设培训学校百度关键词搜索工具
  • 英文案例网站百度官网app下载
  • 宁国做网站的营销网站建设制作
  • 莱芜网站优化费用免费浏览网站推广
  • 专业商城网站设计制作百度公司好进吗
  • 六安网站建设软件注册推广平台
  • ui网站建设站评价seo推广主要做什么
  • wordpress关闭搜索功能电脑优化用什么软件好
  • 替人做非法网站willfast优化工具下载
  • 网站开发配置表格免费创建网站的平台
  • 大连网络营销网站武汉大学人民医院地址
  • 网站建设bd方案广州推广优化
  • 国际贸易相关网站网站卖链接
  • 网站开发中涉及的侵权行为谷歌seo新规则
  • 做网站周记新闻头条国内大事