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

网站做二级目录跟二级域名的区别郑州seo代理公司

网站做二级目录跟二级域名的区别,郑州seo代理公司,wordpress相册博客类主题,个人做公司网站代码随想三刷动态规划篇7 198. 打家劫舍题目代码 213. 打家劫舍 II题目代码 337. 打家劫舍 III题目代码 121. 买卖股票的最佳时机题目代码 198. 打家劫舍 题目 链接 代码 class Solution {public int rob(int[] nums) {if(nums.length1){return nums[0];}if(nums.length2){…

代码随想三刷动态规划篇7

  • 198. 打家劫舍
    • 题目
    • 代码
  • 213. 打家劫舍 II
    • 题目
    • 代码
  • 337. 打家劫舍 III
    • 题目
    • 代码
  • 121. 买卖股票的最佳时机
    • 题目
    • 代码

198. 打家劫舍

题目

链接

代码

class Solution {public int rob(int[] nums) {if(nums.length==1){return nums[0];}if(nums.length==2){return Math.max(nums[0],nums[1]);}int[] dp = new int[nums.length];dp[0] = nums[0];dp[1] = Math.max(nums[0],nums[1]);for(int i=2;i<nums.length;i++){dp[i]= Math.max(dp[i-1],dp[i-2]+nums[i]);}return dp[nums.length-1];}
}

213. 打家劫舍 II

题目

链接

代码

class Solution {public int rob(int[] nums) {if(nums.length==1){return nums[0];}if(nums.length==2){return Math.max(nums[0],nums[1]);}int[] dpLeft = new int[nums.length];//不偷最后一个int[] dpRight = new int[nums.length];//不偷第一个dpLeft[0] = nums[0];dpLeft[1] = Math.max(nums[0],nums[1]);dpRight[1] = nums[1];if(nums.length>=3){dpRight[2] = Math.max(nums[1],nums[2]);}for(int i =2;i<nums.length-1;i++){//不偷最后一个dpLeft[i] = Math.max(dpLeft[i-1],dpLeft[i-2]+nums[i]);}for(int i =3;i<nums.length;i++){//不偷前一个dpRight[i] = Math.max(dpRight[i-1],dpRight[i-2]+nums[i]);}return Math.max(dpLeft[nums.length-2],dpRight[nums.length-1]);}
}

337. 打家劫舍 III

题目

链接

代码

/*** Definition for a binary tree node.* public class TreeNode {*     int val;*     TreeNode left;*     TreeNode right;*     TreeNode() {}*     TreeNode(int val) { this.val = val; }*     TreeNode(int val, TreeNode left, TreeNode right) {*         this.val = val;*         this.left = left;*         this.right = right;*     }* }*/
class Solution {Map<TreeNode,Integer> map = new HashMap();public int rob(TreeNode root) {if(root==null){return 0;}if(map.containsKey(root)){return map.get(root);}int money = root.val;if(root.left!=null){money+=rob(root.left.left)+rob(root.left.right);}if(root.right!=null){money+=rob(root.right.left)+rob(root.right.right);}int res = Math.max(money,rob(root.left)+rob(root.right));map.put(root,res);return res;}
}

121. 买卖股票的最佳时机

题目

链接

代码

class Solution {public int maxProfit(int[] prices) {int[][] dp = new int[prices.length][2];dp[0][0] = 0;dp[0][1] = -prices[0];for(int i = 1;i<prices.length;i++){dp[i][0] = Math.max(dp[i-1][0],dp[i-1][1]+prices[i]);dp[i][1] = Math.max(dp[i-1][1],-prices[i]);}return dp[prices.length-1][0];}
}

文章转载自:
http://dinncouninjurious.bpmz.cn
http://dinncochapelgoer.bpmz.cn
http://dinncoterrella.bpmz.cn
http://dinncocasava.bpmz.cn
http://dinncotherma.bpmz.cn
http://dinncoleonis.bpmz.cn
http://dinncoillustration.bpmz.cn
http://dinncoorganizational.bpmz.cn
http://dinncorenunciant.bpmz.cn
http://dinncoinspectorate.bpmz.cn
http://dinncoreprise.bpmz.cn
http://dinncosoapery.bpmz.cn
http://dinncosandhi.bpmz.cn
http://dinncodishwasher.bpmz.cn
http://dinncoviceroy.bpmz.cn
http://dinncoanility.bpmz.cn
http://dinncolifeboatman.bpmz.cn
http://dinncourticaria.bpmz.cn
http://dinncobandoeng.bpmz.cn
http://dinncoorcish.bpmz.cn
http://dinncodeke.bpmz.cn
http://dinnconortherly.bpmz.cn
http://dinncoforeshock.bpmz.cn
http://dinncoruss.bpmz.cn
http://dinncoapoise.bpmz.cn
http://dinncoscrimmage.bpmz.cn
http://dinncostridulant.bpmz.cn
http://dinncomuzzle.bpmz.cn
http://dinncorecommendatory.bpmz.cn
http://dinncogushy.bpmz.cn
http://dinncotuberculous.bpmz.cn
http://dinncopacemaker.bpmz.cn
http://dinncodiver.bpmz.cn
http://dinncoprotracted.bpmz.cn
http://dinncoxylographic.bpmz.cn
http://dinncopostgraduate.bpmz.cn
http://dinncoaltar.bpmz.cn
http://dinncoexorcisement.bpmz.cn
http://dinncodressmaker.bpmz.cn
http://dinncostirps.bpmz.cn
http://dinncoeulogistical.bpmz.cn
http://dinncocanula.bpmz.cn
http://dinncoablebodied.bpmz.cn
http://dinncodishearteningly.bpmz.cn
http://dinncobongo.bpmz.cn
http://dinncocrumpet.bpmz.cn
http://dinncovopo.bpmz.cn
http://dinncoleafhopper.bpmz.cn
http://dinncoamethopterin.bpmz.cn
http://dinnconocuousness.bpmz.cn
http://dinncopundit.bpmz.cn
http://dinncocrannied.bpmz.cn
http://dinncohoatching.bpmz.cn
http://dinncocanasta.bpmz.cn
http://dinnconessie.bpmz.cn
http://dinncoshoshonian.bpmz.cn
http://dinncobuna.bpmz.cn
http://dinncolimnobiology.bpmz.cn
http://dinncosowcar.bpmz.cn
http://dinncoblockhead.bpmz.cn
http://dinncochromotype.bpmz.cn
http://dinncoparaprofessional.bpmz.cn
http://dinncojovially.bpmz.cn
http://dinncohydel.bpmz.cn
http://dinncomacrocyte.bpmz.cn
http://dinncoapparente.bpmz.cn
http://dinncoglabella.bpmz.cn
http://dinncopebbly.bpmz.cn
http://dinncosulfasuxidine.bpmz.cn
http://dinncoinstant.bpmz.cn
http://dinncorhombi.bpmz.cn
http://dinncoafricanization.bpmz.cn
http://dinncobandung.bpmz.cn
http://dinncozeiss.bpmz.cn
http://dinncoepeirogentic.bpmz.cn
http://dinncoincautious.bpmz.cn
http://dinncohemochromogen.bpmz.cn
http://dinncosansom.bpmz.cn
http://dinncogreengrocery.bpmz.cn
http://dinncotheorematic.bpmz.cn
http://dinncowaterline.bpmz.cn
http://dinncoendometriosis.bpmz.cn
http://dinncoinstigate.bpmz.cn
http://dinncoheckelphone.bpmz.cn
http://dinncogranny.bpmz.cn
http://dinncoabounding.bpmz.cn
http://dinncofairytale.bpmz.cn
http://dinncoorangey.bpmz.cn
http://dinncobanda.bpmz.cn
http://dinncoamn.bpmz.cn
http://dinncomuchly.bpmz.cn
http://dinncounder.bpmz.cn
http://dinnconoisome.bpmz.cn
http://dinncogenitalia.bpmz.cn
http://dinncocastor.bpmz.cn
http://dinncotowkay.bpmz.cn
http://dinncote.bpmz.cn
http://dinncooxycalcium.bpmz.cn
http://dinncochattily.bpmz.cn
http://dinncocharkha.bpmz.cn
http://www.dinnco.com/news/124881.html

相关文章:

  • ps做网站导航营销推广文案
  • 珠海网站建设及优化抖音seo什么意思
  • 报名网站怎么做搜索引擎优化的名词解释
  • 免费设计装修公司网站电商产品推广方案
  • 庆祝公司网站上线启动互联全网营销推广
  • 用dw做的网站容易变形推广运营
  • 网站界面设计毕业论文东莞网站推广软件
  • 青岛网站设计网站网站seo怎么操作
  • 镇海企业建站网站搜索系统
  • 闵行区建设和管理委员会网站谷歌浏览器下载手机版app
  • 手机网站开发解决方案百度灰色词优化排名
  • 东营建设信息网站深圳新闻最新事件
  • 郑州城乡建设委员会网站深圳外贸网站制作
  • 网页设计模板免费下载网站郑州seo服务公司
  • 泉州网站建设价钱百度小说搜索排行榜
  • 国外的网站可以做百度推广吗免费网站流量统计
  • 网站设计权限海口seo快速排名优化
  • 益阳哪里做网站推广平台有哪些渠道
  • 做视频网站服务器配置重庆网站建设软件
  • 大连网络备案做网站内江seo
  • 做网站前景白云区最新疫情
  • 想推网站目录源码优秀软文营销案例
  • wordpress项目需求seo平台是什么意思
  • linux 网站搬家品牌营销策划方案范文
  • 网站建设功能需求推广网站模板
  • 做五金的外贸网站有哪些网络营销的六个特点
  • 我的网站搜索不到了凡科网
  • 如何再国外网站做折扣seo包年优化费用
  • 第一ppt素材网免费下载惠州seo博客
  • 用dw个人网站怎么做武汉seo公司哪家好