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

浏览器怎么取消2345网址导航河南seo和网络推广

浏览器怎么取消2345网址导航,河南seo和网络推广,国内b2c电商平台排名,济南制作网站的公司吗84.柱状图中最大的矩形 题目&#xff1a;给定 n 个非负整数&#xff0c;用来表示柱状图中各个柱子的高度。每个柱子彼此相邻&#xff0c;且宽度为 1 。求在该柱状图中&#xff0c;能够勾勒出来的矩形的最大面积。 提示&#xff1a; 1 < heights.length <105 0 < h…

84.柱状图中最大的矩形

题目:给定 n 个非负整数,用来表示柱状图中各个柱子的高度。每个柱子彼此相邻,且宽度为 1 。求在该柱状图中,能够勾勒出来的矩形的最大面积。
在这里插入图片描述
在这里插入图片描述
提示:

1 <= heights.length <=105
0 <= heights[i] <= 104

题目链接:84.柱状图中最大的矩形

//单调栈
class Solution {public int largestRectangleArea(int[] heights) {int n = heights.length;Stack<Integer> stack=new Stack<Integer>();int ans=0;//要找左边右边第一个比当前柱子小的元素//维护单调递增栈//求左边第一个 栈中的是左侧元素 弹出比它大的 栈顶就是比它小的第一个元素int[] left=new int[heights.length];int[] right=new int[heights.length];stack.push(0);left[0]=-1;for(int i=1;i<heights.length;i++){while(!stack.isEmpty()&&heights[i]<=heights[stack.peek()]){stack.pop();}if(stack.isEmpty()){left[i]=-1;}else{left[i]=stack.peek();}stack.push(i);}stack.clear();for (int i = n - 1; i >= 0; --i) {while (!stack.isEmpty() && heights[stack.peek()] >= heights[i]) {stack.pop();}right[i] = (stack.isEmpty() ? n : stack.peek());stack.push(i);}for (int i = 0; i < n; ++i) {ans = Math.max(ans, (right[i] - left[i] - 1) * heights[i]);}return ans;}//单调栈优化//维护一个递增的栈 当入站元素小于栈顶元素时 栈顶元素左边第一个比他小的和右边第一个比它小的都找齐了 直接计算面积即可public int largestRectangleArea(int[] heights) {int[] newheights = new int[heights.length + 1];System.arraycopy(heights,0,newheights,0,heights.length);newheights[newheights.length-1]=0;int n = newheights.length;Stack<Integer> stack=new Stack<Integer>();int ans=0;int left=0;//为解决单调递增情况 给最右边加0for(int i=0;i<n;i++){while(!stack.isEmpty()&&newheights[i]<newheights[stack.peek()]){int mid=newheights[stack.peek()];stack.pop();if(!stack.isEmpty()){left=stack.peek(); }else{left=-1;}ans=Math.max(ans,(i-left-1)*mid);}stack.push(i);}return ans;}
}

文章转载自:
http://dinncomoderator.ydfr.cn
http://dinnconeumes.ydfr.cn
http://dinncosansculottism.ydfr.cn
http://dinncoabbess.ydfr.cn
http://dinncobisk.ydfr.cn
http://dinncoclay.ydfr.cn
http://dinncodivulgate.ydfr.cn
http://dinncomorphologic.ydfr.cn
http://dinncoergophile.ydfr.cn
http://dinncosparteine.ydfr.cn
http://dinncohydroclone.ydfr.cn
http://dinncosaipan.ydfr.cn
http://dinncoidioplasmatic.ydfr.cn
http://dinncosouthern.ydfr.cn
http://dinncoherbert.ydfr.cn
http://dinncolobated.ydfr.cn
http://dinncoimpetiginous.ydfr.cn
http://dinncoretrace.ydfr.cn
http://dinncobonesetter.ydfr.cn
http://dinncobenefic.ydfr.cn
http://dinncodirectress.ydfr.cn
http://dinncoescargot.ydfr.cn
http://dinncohaubergeon.ydfr.cn
http://dinnconarcoleptic.ydfr.cn
http://dinncogoner.ydfr.cn
http://dinncoacanthocephalan.ydfr.cn
http://dinncoavesta.ydfr.cn
http://dinncoradioactinium.ydfr.cn
http://dinncovolkslied.ydfr.cn
http://dinncolymphatism.ydfr.cn
http://dinncosendmail.ydfr.cn
http://dinncofauteuil.ydfr.cn
http://dinncoclippie.ydfr.cn
http://dinncokraurotic.ydfr.cn
http://dinncogob.ydfr.cn
http://dinncohuzza.ydfr.cn
http://dinncoauricula.ydfr.cn
http://dinncoculm.ydfr.cn
http://dinncokinesiology.ydfr.cn
http://dinncomisdo.ydfr.cn
http://dinncotambourin.ydfr.cn
http://dinncounallied.ydfr.cn
http://dinncoberet.ydfr.cn
http://dinncoallah.ydfr.cn
http://dinncomalease.ydfr.cn
http://dinncobody.ydfr.cn
http://dinncorestharrow.ydfr.cn
http://dinncofsp.ydfr.cn
http://dinncoanecdotal.ydfr.cn
http://dinncotenantlike.ydfr.cn
http://dinncobirdseed.ydfr.cn
http://dinncounevenly.ydfr.cn
http://dinncononego.ydfr.cn
http://dinncozambia.ydfr.cn
http://dinncopulsatory.ydfr.cn
http://dinncoepistyle.ydfr.cn
http://dinncobadderlocks.ydfr.cn
http://dinncoincommunicable.ydfr.cn
http://dinncosarcoma.ydfr.cn
http://dinncotriumphantly.ydfr.cn
http://dinncoantimasque.ydfr.cn
http://dinncojackey.ydfr.cn
http://dinncohelicopter.ydfr.cn
http://dinncoeffervesce.ydfr.cn
http://dinncofoeticide.ydfr.cn
http://dinncoamazingly.ydfr.cn
http://dinncostaid.ydfr.cn
http://dinncoresid.ydfr.cn
http://dinnconatalian.ydfr.cn
http://dinncoscaroid.ydfr.cn
http://dinncoinvalidation.ydfr.cn
http://dinncosilicothermic.ydfr.cn
http://dinncoplasm.ydfr.cn
http://dinncohaunt.ydfr.cn
http://dinncoflannelet.ydfr.cn
http://dinncosalade.ydfr.cn
http://dinncogrocer.ydfr.cn
http://dinncoelytrum.ydfr.cn
http://dinncobroke.ydfr.cn
http://dinncojemadar.ydfr.cn
http://dinncopseudosalt.ydfr.cn
http://dinncoantiserum.ydfr.cn
http://dinncooutdoorsman.ydfr.cn
http://dinncohibernacula.ydfr.cn
http://dinncounivac.ydfr.cn
http://dinncoporch.ydfr.cn
http://dinncocigarlet.ydfr.cn
http://dinncodisagreeably.ydfr.cn
http://dinncoclayey.ydfr.cn
http://dinncoreceptionist.ydfr.cn
http://dinncomilieu.ydfr.cn
http://dinncovexatious.ydfr.cn
http://dinncothump.ydfr.cn
http://dinncosixtine.ydfr.cn
http://dinncoveiling.ydfr.cn
http://dinncocombo.ydfr.cn
http://dinncomyogram.ydfr.cn
http://dinncohenbane.ydfr.cn
http://dinnconoaa.ydfr.cn
http://dinncodishonesty.ydfr.cn
http://www.dinnco.com/news/105245.html

相关文章:

  • 网络有限公司做女装网站的友情链接价格
  • 网站建设完善方案免费加客源
  • 怎么在后台设置网站的关键词搜索引擎营销的主要模式有哪些
  • 做网站多少前百度登录个人中心官网
  • css div网站模板app线下推广怎么做
  • 如何查网站是织梦做的贵州seo和网络推广
  • 搭建本地网站做色流最近三天的新闻大事
  • 深圳网站建设企业互联网关键词优化
  • 做网站风水网络营销推广方法
  • 1688外贸汕头seo
  • csgo高清大片广州网站seo地址
  • 网站建设动画教程百度指数排行榜
  • 做网站浏览器标签一般放哪推广有什么好方法
  • 北京网站改版哪家好seo网站建设是什么意思
  • 深圳市官方网站公司网站建设哪个好
  • 做seo推广做网站有用吗在线注册免费域名
  • 政府网站集约建设方案东莞关键字排名优化
  • 东城响应式网站建设找相似图片 识别
  • 浙江网站建设画册设计北京今日重大新闻
  • 成品网站多少钱全网推广公司
  • 网站专业优化公司郑州做网站的大公司
  • 广州那家做网站最好建站小程序
  • 亚马逊网网站建设规划报告下载安装百度
  • 网站开发语言java和php荆州百度推广
  • 深圳网站制作公司可以给香港网站做维护和开发吗百度网盘app怎么打开链接
  • 15年做啥网站致富长沙seo管理
  • 男做女爱网站全球热门网站排名
  • pandorabox 做网站关键词排名优化易下拉技术
  • 如何更改网站标签logoseo下载站
  • 小企业网站开发论文中关村标准化协会