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

网站建设可行性研究报告范文三河市建设局网站

网站建设可行性研究报告范文,三河市建设局网站,2024网站推广,东莞做网络推广的公司随想录日记part49 t i m e #xff1a; time#xff1a; time#xff1a; 2024.04.20 主要内容#xff1a;今天开始要学习单调栈的相关知识了#xff0c;今天的内容主要涉及#xff1a;柱状图中最大的矩形 84.柱状图中最大的矩形 Topic184.柱状图中最大的矩形 题目 time time 2024.04.20 主要内容今天开始要学习单调栈的相关知识了今天的内容主要涉及柱状图中最大的矩形 84.柱状图中最大的矩形 Topic184.柱状图中最大的矩形 题目 思路 代码实现如下 class Solution {public int largestRectangleArea(int[] heights) {// 双指针法int result 0;int len heights.length;int[] left new int[len];int[] right new int[len];left[0] -1;for (int i 1; i len; i) {int t i - 1;while (t 0 heights[t] heights[i])t left[t];left[i] t;}right[len - 1] len;for (int i len - 2; i 0; i--) {int t i 1;while (t len heights[t] heights[i])t right[t];right[i] t;}for (int i 0; i len; i) {int tem heights[i] * (right[i] - left[i] - 1);result Math.max(tem, result);}return result;} }时间复杂度 O ( n ) O(n) O(n) 空间复杂度 O ( n ) O(n) O(n) Topic2 接雨水 思路 与接雨水很像 class Solution {public int largestRectangleArea(int[] heights) {int result 0;int len heights.length;int[] newheights new int[len 2];newheights[0] 0;newheights[len 1] 0;for (int i 0; i len; i) {newheights[i 1] heights[i];}heights newheights;StackInteger stack new Stack();stack.push(0);for (int i 1; i len 2; i) {if (heights[i] heights[stack.peek()]) {stack.push(i);} else if (heights[i] heights[stack.peek()]) {stack.pop();stack.push(i);} else {while (!stack.isEmpty() heights[i] heights[stack.peek()]) {int mid stack.pop();if (!stack.isEmpty()) {int h heights[mid];int w i - stack.peek() - 1;result Math.max(h * w, result);}}stack.push(i);}}return result;} }class Solution {public int trap(int[] height) {// 双指针法int result 0;int len height.length;for (int i 0; i len; i) {if (i 0 || i len - 1)continue;int lheight height[i];int rheight height[i];for (int l i - 1; l 0; l--) {lheight Math.max(lheight, height[l]);}for (int r i 1; r len; r) {rheight Math.max(rheight, height[r]);}int tem Math.min(rheight, lheight) - height[i];if (tem 0)result tem;}return result;} }时间复杂度 O ( n ) O(n) O(n) 空间复杂度 O ( n ) O(n) O(n)
http://www.zqtcl.cn/news/210775/

相关文章:

  • 新公司网站建设合肥关键词排名优化
  • 网站排名优化+o+m西安网络推广平台公司
  • 找网站建设公司需要注意什么常州网站建设公司好么
  • 不备案的网站很慢网站双线主机优势
  • 南京电子商务网站建设23个营销专业术语
  • 建设银行官网官方网站学习网页制作的网站
  • 开发网站需要什么硬件今年最流行的装修风格
  • 门户网站建设中标结果百度资讯指数
  • 定制企业网站开发公司网站建设的6个基本步骤
  • 网站建设与维护案列网站作品怎么做
  • 茂名放心营销网站开发seo收费
  • 旅游网站品牌建设本地使用宝塔安装wordpress
  • 专门做外链的网站制作论坛类网站模板免费下载
  • 靖江建设行业协会网站投资做网站
  • 做网站视频背景潍坊网站制作建设
  • 深圳市官网网站建设哪家好百度抓取网站登录
  • 免费做cpa单页网站友情链接买卖代理
  • 免费网站建站排名中国最大的软件公司
  • 码云pages做静态网站广西建设培训网
  • 建设网站需要花钱吗网站seo方案策划书
  • 德阳网站怎么做seo陈木胜个人资料
  • 电子规划书商务网站建设wordpress主机推荐
  • wordpress设置多站点html5开发手机app
  • 移动互联和网站开发哪个好做推广便宜的网站有哪些
  • 极速网站建设定制价格微信公众号运营助手
  • .net制作网站开发教程在线修图编辑器
  • 哪些网站可以做详情页聊城高新区建设局网站
  • 湖南网站优化代运营山东建设厅证件查询网址
  • 以百度云做网站空间浙江外贸网站建设
  • 南通网站建设推广专家wordpress 信息流 主题