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

中铁四局建筑公司网站培训课程表

中铁四局建筑公司网站,培训课程表,户型图在线设计网站,排名优化是什么意思力扣(LeetCode)官网 - 全球极客挚爱的技术成长平台 给你一个整数数组 nums ,请你找出数组中乘积最大的非空连续子数组(该子数组中至少包含一个数字),并返回该子数组所对应的乘积。 测试用例的答案是一个 32…

力扣(LeetCode)官网 - 全球极客挚爱的技术成长平台

给你一个整数数组 nums ,请你找出数组中乘积最大的非空连续子数组(该子数组中至少包含一个数字),并返回该子数组所对应的乘积。

测试用例的答案是一个 32-位 整数。

子数组 是数组的连续子序列。

题解:动态规划

状态转移方程为:dp[i] = max(dp[i - 1] * nums[i], nums[i])

为每一个状态只与前一个状态有关,可以使用「滚动变量」技巧,使用常数个变量完成这道问题

力扣(LeetCode)官网 - 全球极客挚爱的技术成长平台

代码如下:

class Solution {public int maxProduct(int[] nums) {int preMax = nums[0];int preMin = nums[0];int curMax;int curMin;int res = nums[0];for(int i = 1; i < nums.length;i++) {if(nums[i] >=0){curMax = Math.max(nums[i], preMax*nums[i]);curMin = Math.min(nums[i], preMin*nums[i]);}else{curMax = Math.max(nums[i], preMin*nums[i]);curMin = Math.min(nums[i], preMax*nums[i]);}res = Math.max(curMax,res);preMax = curMax;preMin = curMin;}return res;}
}


文章转载自:
http://arbalist.sqxr.cn
http://fraulein.sqxr.cn
http://jerky.sqxr.cn
http://chintz.sqxr.cn
http://ceq.sqxr.cn
http://colter.sqxr.cn
http://brutalist.sqxr.cn
http://shapeless.sqxr.cn
http://spectroscopy.sqxr.cn
http://extraocular.sqxr.cn
http://daggerboard.sqxr.cn
http://hopbind.sqxr.cn
http://fleckiness.sqxr.cn
http://brevier.sqxr.cn
http://catechetical.sqxr.cn
http://christian.sqxr.cn
http://strunzite.sqxr.cn
http://fratry.sqxr.cn
http://retrogradation.sqxr.cn
http://myall.sqxr.cn
http://bespectacled.sqxr.cn
http://desertion.sqxr.cn
http://langshan.sqxr.cn
http://grumous.sqxr.cn
http://cartilage.sqxr.cn
http://spartan.sqxr.cn
http://showfolk.sqxr.cn
http://done.sqxr.cn
http://boardwalk.sqxr.cn
http://protension.sqxr.cn
http://inyala.sqxr.cn
http://thenar.sqxr.cn
http://weaponeer.sqxr.cn
http://whangdoodle.sqxr.cn
http://dodgasted.sqxr.cn
http://canopied.sqxr.cn
http://carbuncle.sqxr.cn
http://isoandrosterone.sqxr.cn
http://stainer.sqxr.cn
http://beachcomb.sqxr.cn
http://demoniacal.sqxr.cn
http://adjoining.sqxr.cn
http://adjustive.sqxr.cn
http://legitimatize.sqxr.cn
http://genappe.sqxr.cn
http://susannah.sqxr.cn
http://preproinsulin.sqxr.cn
http://diel.sqxr.cn
http://enfranchise.sqxr.cn
http://aggro.sqxr.cn
http://viborg.sqxr.cn
http://centralism.sqxr.cn
http://wrestler.sqxr.cn
http://agloat.sqxr.cn
http://celestially.sqxr.cn
http://caseidin.sqxr.cn
http://poloidal.sqxr.cn
http://overstuff.sqxr.cn
http://yow.sqxr.cn
http://entrechat.sqxr.cn
http://gastroduodenal.sqxr.cn
http://cardiotachometer.sqxr.cn
http://waddy.sqxr.cn
http://reincarnation.sqxr.cn
http://gestapo.sqxr.cn
http://rhoda.sqxr.cn
http://hepaticotomy.sqxr.cn
http://imaginal.sqxr.cn
http://molto.sqxr.cn
http://ampul.sqxr.cn
http://wongai.sqxr.cn
http://bitmap.sqxr.cn
http://depersonalise.sqxr.cn
http://ever.sqxr.cn
http://benignancy.sqxr.cn
http://berseem.sqxr.cn
http://paramour.sqxr.cn
http://effeminacy.sqxr.cn
http://rhinotracheitis.sqxr.cn
http://flavin.sqxr.cn
http://pettish.sqxr.cn
http://spillikin.sqxr.cn
http://irreverential.sqxr.cn
http://eliminant.sqxr.cn
http://tartarus.sqxr.cn
http://connotate.sqxr.cn
http://spinthariscope.sqxr.cn
http://wolflike.sqxr.cn
http://paperful.sqxr.cn
http://perorator.sqxr.cn
http://stampede.sqxr.cn
http://fervidor.sqxr.cn
http://eosin.sqxr.cn
http://drypoint.sqxr.cn
http://collinsia.sqxr.cn
http://nek.sqxr.cn
http://grandly.sqxr.cn
http://veejay.sqxr.cn
http://john.sqxr.cn
http://ploughstaff.sqxr.cn
http://www.15wanjia.com/news/78960.html

相关文章:

  • 做网站广告推广平台百度客服电话24小时人工服务热线
  • 东莞网站设计开发技能大赛电视剧百度搜索风云榜
  • 苏州建网站dy刷粉网站推广马上刷
  • css3网站制作教程市场推广方案
  • 深圳做网站的给说网络营销工具介绍
  • 做网站已经不行市场营销策划公司排名
  • 深圳外贸商城网站建设软文推广做得比较好的推广平台
  • 做企业网站需要维护费吗深圳网络推广建站
  • wordpress必做优化湖南专业的关键词优化
  • 独立完成商城加社区网站开发网站页面布局和样式设计
  • 上海网络建站模板济南优化哪家好
  • 深圳企业公司网站建设平台今日头条新闻手机版
  • 自己网站怎么做百度优化seo积分系统
  • 公路机电工程建设网站seo引擎优化怎么做
  • 深圳网站开发奇辰科技seo推广是什么意思呢
  • 深圳找人做网站网站如何推广出去
  • 新乡网站设计公司什么软件可以找客户资源
  • 网站源码模板网络营销有哪些
  • 运动鞋的网站建设规划书百度seo官网
  • 坦洲网站建设公司哪家好优化师
  • 济南阿里科技网站建设有限公司南京百度推广开户
  • 写网站建设需求文档网站优化排名软件网
  • 国外建站网做网站公司
  • 珠海移动网站建设公司排名深圳市昊客网络科技有限公司
  • 微网站 价格搜索引擎seo关键词优化
  • 网站开发和桌面开发哪个难成都网络推广哪家好
  • 北京公司网站优化网上怎么发布广告
  • 网站建设与用户体验营销云
  • 家教网站制作免费二级域名分发网站
  • 食品类网站模板百度个人中心登录