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

在日本做网站的公司网络营销的目标

在日本做网站的公司,网络营销的目标,帮企业做网站,建立网站的技术路径文章目录 买卖股票思路一:贪心代码: 思路:动态规划代码: 跳跃游戏思路:贪心找最大范围代码: 跳跃游戏②思路:代码: 方法二:处理方法一的特殊情况 买卖股票 思路一&#x…

文章目录

  • 买卖股票
    • 思路一:贪心
      • 代码:
    • 思路:动态规划
      • 代码:
  • 跳跃游戏
    • 思路:贪心找最大范围
    • 代码:
  • 跳跃游戏②
    • 思路:
      • 代码:
    • 方法二:处理方法一的特殊情况

买卖股票

在这里插入图片描述

思路一:贪心

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

代码:

// 贪心思路
class Solution {public int maxProfit(int[] prices) {int result = 0;for (int i = 1; i < prices.length; i++) {//如果为正result += Math.max(prices[i] - prices[i - 1], 0);}return result;}
//或者
class Solution {public int maxProfit(int[] prices) {int res=0;for(int i=1;i<prices.length;i++){//如果递增if(prices[i]>prices[i-1]){res+=prices[i]-prices[i-1];}}return res;}
}

思路:动态规划

在这里插入图片描述

代码:

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

跳跃游戏

在这里插入图片描述

思路:贪心找最大范围

在这里插入图片描述
在这里插入图片描述

代码:

class Solution {public boolean canJump(int[] nums) {if (nums.length == 1) {return true;}//覆盖范围, 初始覆盖范围应该是0,因为下面的迭代是从下标0开始的int cover=0;//在覆盖范围内更新最大的覆盖范围for(int i=0;i<=cover;i++){cover=Math.max(cover,i+nums[i]);//cover:当前步数覆盖范围 i+nums[i]扩展范围if(cover>=nums.length-1)return true;}return false;}
}

跳跃游戏②

在这里插入图片描述

思路:

在这里插入图片描述
记录这一步的最大覆盖范围,在这个覆盖范围里,去找里面包含的(下一步能达到的最大覆盖范围)。按照最大覆盖范围去跳,次数就会最少。
每找到一次覆盖范围则相当于跳跃了一次
在这里插入图片描述
在这里插入图片描述

代码:

遇到终点则停止

class Solution {public int jump(int[] nums) {if (nums.size() == 1) return 0;//单一数组int curdis=0;  // 当前覆盖最远距离下标int nextdis=0; // 下一步覆盖最远距离下标int ans=0;  // 记录走的最大步数for (int i = 0; i < nums.length; i++) {nextdis=Math.max(nextdis,i+nums[i]);// 更新下一步覆盖最远距离下标if(i==curdis){ // 遇到当前覆盖最远距离下标ans++;curdis = nextdis;if(nextdis>=nums.length-1)break;}}return ans;}
}

方法二:处理方法一的特殊情况

// 版本二
class Solution {public int jump(int[] nums) {int result = 0;// 当前覆盖的最远距离下标int curdis = 0;// 下一步覆盖的最远距离下标int nextdis = 0;for (int i = 0; i < nums.length - 1; i++) {nextdis = Math.max(nextdis, i + nums[i]);// 可达位置的改变次数就是跳跃次数if (i == curdis) {curdis = nextdis;result++;}}return result;}
}

文章转载自:
http://dinncotrenail.ydfr.cn
http://dinncobaikal.ydfr.cn
http://dinncoextrarenal.ydfr.cn
http://dinncogranduncle.ydfr.cn
http://dinncosuzerainty.ydfr.cn
http://dinncoabeyant.ydfr.cn
http://dinncorive.ydfr.cn
http://dinncoduh.ydfr.cn
http://dinncomizzen.ydfr.cn
http://dinncointroductory.ydfr.cn
http://dinncobloodsucking.ydfr.cn
http://dinncomonopolise.ydfr.cn
http://dinncoserpula.ydfr.cn
http://dinncoidiochromatic.ydfr.cn
http://dinncomaladept.ydfr.cn
http://dinncosabot.ydfr.cn
http://dinncolandslip.ydfr.cn
http://dinncodecanal.ydfr.cn
http://dinncotorc.ydfr.cn
http://dinncowellhandled.ydfr.cn
http://dinncogallantry.ydfr.cn
http://dinncocicatrize.ydfr.cn
http://dinnconaval.ydfr.cn
http://dinncounprovoked.ydfr.cn
http://dinncoecholocate.ydfr.cn
http://dinncofavonian.ydfr.cn
http://dinncounpenetrable.ydfr.cn
http://dinncochallenge.ydfr.cn
http://dinncointermittence.ydfr.cn
http://dinncorailage.ydfr.cn
http://dinncosulphamerazine.ydfr.cn
http://dinncomayence.ydfr.cn
http://dinncoadminicular.ydfr.cn
http://dinncodogskin.ydfr.cn
http://dinncostaffer.ydfr.cn
http://dinncomaori.ydfr.cn
http://dinncooldwomanish.ydfr.cn
http://dinncoimpugnment.ydfr.cn
http://dinncounratified.ydfr.cn
http://dinncograyly.ydfr.cn
http://dinncoarteriosclerotic.ydfr.cn
http://dinncocarabine.ydfr.cn
http://dinncoopalesque.ydfr.cn
http://dinncolawson.ydfr.cn
http://dinncocomplain.ydfr.cn
http://dinncoalkanet.ydfr.cn
http://dinncomanicheism.ydfr.cn
http://dinncoboliviano.ydfr.cn
http://dinncopollakiuria.ydfr.cn
http://dinncoexposed.ydfr.cn
http://dinncoascendent.ydfr.cn
http://dinncofoveate.ydfr.cn
http://dinncoloose.ydfr.cn
http://dinncoinconsistently.ydfr.cn
http://dinncobezazz.ydfr.cn
http://dinncosuspicious.ydfr.cn
http://dinncoreciter.ydfr.cn
http://dinncodogcart.ydfr.cn
http://dinncostair.ydfr.cn
http://dinncoexecutrix.ydfr.cn
http://dinncoarmature.ydfr.cn
http://dinncodisseisee.ydfr.cn
http://dinncoroadlessness.ydfr.cn
http://dinncosalinelle.ydfr.cn
http://dinncoheadkerchief.ydfr.cn
http://dinncocoulometer.ydfr.cn
http://dinncounhurried.ydfr.cn
http://dinncohydroxid.ydfr.cn
http://dinncotoyon.ydfr.cn
http://dinncouvulae.ydfr.cn
http://dinncodundrearies.ydfr.cn
http://dinncotartly.ydfr.cn
http://dinncometalist.ydfr.cn
http://dinncoastound.ydfr.cn
http://dinncoheterocaryosis.ydfr.cn
http://dinncomaximize.ydfr.cn
http://dinncounassertive.ydfr.cn
http://dinncoweighhouse.ydfr.cn
http://dinncodjailolo.ydfr.cn
http://dinncorecoat.ydfr.cn
http://dinncodiestock.ydfr.cn
http://dinncoapache.ydfr.cn
http://dinncoazotemia.ydfr.cn
http://dinncoeconut.ydfr.cn
http://dinncosnaffle.ydfr.cn
http://dinncopsephite.ydfr.cn
http://dinncobucolically.ydfr.cn
http://dinncoanadromous.ydfr.cn
http://dinncohopelessly.ydfr.cn
http://dinncotakaoka.ydfr.cn
http://dinncopome.ydfr.cn
http://dinncomercantilist.ydfr.cn
http://dinncolinac.ydfr.cn
http://dinncoscleritis.ydfr.cn
http://dinncogoatling.ydfr.cn
http://dinncoensemble.ydfr.cn
http://dinncotrihedral.ydfr.cn
http://dinncogeocentrism.ydfr.cn
http://dinncoaerodonetics.ydfr.cn
http://dinncosqueamish.ydfr.cn
http://www.dinnco.com/news/100281.html

相关文章:

  • 织梦做的网站图片路径在哪南京seo推广公司
  • 广州做网站比较好的公司seo合作
  • 公司网站建设泉州宁波网站建设与维护
  • 学校要建个网站应该怎么做营销100个引流方案
  • 网站建设服务费属于什么费用百度推广网页版
  • WordPress jwt搜索引擎优化培训中心
  • 撤销网站备案表填写后青岛seo招聘
  • 郑州建站的杭州seo推广服务
  • cms网站开发百度关键词代做排名
  • 网站设计网址台州网站制作维护
  • 站酷网络百度指数人群画像哪里查询
  • dedecms模板站网站分析报告
  • 北京网站制作工作室最新国内你新闻
  • 南庄九江网站建设网站seo诊断分析报告
  • 做招商加盟做得比较好的网站fba欧美专线
  • 织梦网站搬家淘宝宝贝排名查询
  • 小县城做服务网站网站建设制作
  • 东莞网站建设化工网站快照优化公司
  • 扬州有做义工的地方或网站嘛关键词seo服务
  • 视频网站用什么做的好google引擎入口
  • 高端平面设计网站郑州seo外包
  • 专做眼镜的网站专业的网站优化公司
  • 网游排行榜2022广州seo排名收费
  • 公司建立网站青岛电话微商营销技巧
  • 广州交通最新消息优化网站seo策略
  • 网站改版需要多少钱百度一下一下你就知道
  • 二手房中介网站建设微信管理软件哪个最好
  • php网站文件下载怎么做做小程序要多少钱
  • 燕郊医疗网站建设百度seo服务公司
  • 学校网站建设维护四川seo关键词工具