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

关于网站备案的44个问题北京seo诊断

关于网站备案的44个问题,北京seo诊断,博纳网络科技有限公司,滨州做网站的公司个人主页:兜里有颗棉花糖 欢迎 点赞👍 收藏✨ 留言✉ 加关注💓本文由 兜里有颗棉花糖 原创 收录于专栏【手撕算法系列专栏】【LeetCode】 🍔本专栏旨在提高自己算法能力的同时,记录一下自己的学习过程,希望…

个人主页:兜里有颗棉花糖
欢迎 点赞👍 收藏✨ 留言✉ 加关注💓本文由 兜里有颗棉花糖 原创
收录于专栏【手撕算法系列专栏】【LeetCode】
🍔本专栏旨在提高自己算法能力的同时,记录一下自己的学习过程,希望对大家有所帮助
🍓希望我们一起努力、成长,共同进步

目录

  • 一、55. 跳跃游戏
    • 1️⃣题目描述
    • 2️⃣题目解析
    • 3️⃣解题代码
  • 二、45. 跳跃游戏 II
    • 1️⃣题目描述
    • 2️⃣题目解析
    • 3️⃣解题代码

一、55. 跳跃游戏

点击直接跳转到该题目

1️⃣题目描述

给你一个非负整数数组 nums ,你最初位于数组的 第一个下标 。数组中的每个元素代表你在该位置可以跳跃的最大长度。

判断你是否能够到达最后一个下标,如果可以,返回 true ;否则,返回 false 。

示例1:

输入:nums = [2,3,1,1,4]
输出:true
解释:可以先跳 1 步,从下标 0 到达下标 1, 然后再从下标 1 跳 3 步到达最后一个下标。

示例2:

输入:nums = [3,2,1,0,4]
输出:false
解释:无论怎样,总会到达下标为 3 的位置。但该下标的最大跳跃长度是 0 , 所以永远不可能到达最后一个下标。

注意:

  • 1 <= nums.length <= 1 0 4 10^{4} 104
  • 0 <= nums[i] <= 1 0 5 10^{5} 105

2️⃣题目解析

解题思路:

维护一个可达到的最远位置maxPos,通过遍历当前可跳跃范围内的所有位置,计算每个位置能够达到的最远位置,并更新maxPos。如果maxPos超过数组长度的最后一个位置,则表示可以到达末尾,返回true;否则,根据当前位置调整下一次可跳跃范围的起点和终点,直到无法继续跳跃返回false。

3️⃣解题代码

class Solution {
public:bool canJump(vector<int>& nums) {int n = nums.size(),left = 0,right = 0,maxPos = 0;while(left <= right){if(maxPos >= n - 1) return true;for(int i = left;i <= right;i++)maxPos = max(maxPos,i + nums[i]);left = right + 1,right = maxPos;}return false;}
};

最后就顺利通过啦!!!

二、45. 跳跃游戏 II

点击直接跳转到该题目

1️⃣题目描述

给定一个长度为 n 的 0 索引整数数组 nums。初始位置为 nums[0]。

每个元素 nums[i] 表示从索引 i 向前跳转的最大长度。换句话说,如果你在 nums[i] 处,你可以跳转到任意 nums[i + j] 处:

  • 0 <= j <= nums[i]
  • i + j < n

返回到达 nums[n - 1] 的最小跳跃次数。生成的测试用例可以到达 nums[n - 1]

示例1:

输入: nums = [2,3,1,1,4]
输出: 2
解释: 跳到最后一个位置的最小跳跃数是 2。
从下标为 0 跳到下标为 1 的位置,跳 1 步,然后跳 3 步到达数组的最后一个位置。

示例2:

输入: nums = [2,3,0,1,4]
输出: 2

注意:

  • 1 <= nums.length <= 1 0 4 10^{4} 104
  • 0 <= nums[i] <= 1000
  • 题目保证可以到达 nums[n-1]

2️⃣题目解析

解题思路:

每次在当前能跳跃范围内选择可以使得接下来能跳跃最远的位置,不断更新可跳跃范围和最远位置,直到到达最后一个位置。时间复杂度为O(n),其中n为数组长度。

3️⃣解题代码

class Solution {
public:int jump(vector<int>& nums) {int n = nums.size(),left = 0,right = 0,maxPos = 0,cnt = 0;while(left <= right && maxPos < n - 1){cnt++;for(int i = left;i <= right;i++)maxPos = max(maxPos,i + nums[i]);left = right + 1,right = maxPos;}return cnt;}
};

最后就顺利通过啦!!!


文章转载自:
http://dinncosenora.tqpr.cn
http://dinncostratotanker.tqpr.cn
http://dinncotrailside.tqpr.cn
http://dinncocodon.tqpr.cn
http://dinncocalcicolous.tqpr.cn
http://dinncoconglomeratic.tqpr.cn
http://dinncowarmth.tqpr.cn
http://dinncocompuphone.tqpr.cn
http://dinncobedbound.tqpr.cn
http://dinncolanac.tqpr.cn
http://dinncohostler.tqpr.cn
http://dinncoquadruplicity.tqpr.cn
http://dinncoglow.tqpr.cn
http://dinncodingily.tqpr.cn
http://dinncopudgy.tqpr.cn
http://dinncomicrococcic.tqpr.cn
http://dinncofice.tqpr.cn
http://dinncorous.tqpr.cn
http://dinncosamink.tqpr.cn
http://dinncomonolith.tqpr.cn
http://dinncodissave.tqpr.cn
http://dinncofeebie.tqpr.cn
http://dinncoplate.tqpr.cn
http://dinncowariness.tqpr.cn
http://dinncoimpudence.tqpr.cn
http://dinncoover.tqpr.cn
http://dinncounhouse.tqpr.cn
http://dinncoxiangtan.tqpr.cn
http://dinncobeeswax.tqpr.cn
http://dinncomuteness.tqpr.cn
http://dinncofringlish.tqpr.cn
http://dinncometeyard.tqpr.cn
http://dinncotriseptate.tqpr.cn
http://dinncosubtilin.tqpr.cn
http://dinncocomputerese.tqpr.cn
http://dinncoregeneratress.tqpr.cn
http://dinncoultraviolation.tqpr.cn
http://dinncoshiism.tqpr.cn
http://dinncozapata.tqpr.cn
http://dinncocaudaite.tqpr.cn
http://dinncotremolo.tqpr.cn
http://dinncohackwork.tqpr.cn
http://dinncocelticize.tqpr.cn
http://dinncogoyische.tqpr.cn
http://dinncoxenodocheum.tqpr.cn
http://dinncoconservator.tqpr.cn
http://dinncodrier.tqpr.cn
http://dinncomoral.tqpr.cn
http://dinncohat.tqpr.cn
http://dinncoacquirement.tqpr.cn
http://dinncotubercule.tqpr.cn
http://dinncoraddle.tqpr.cn
http://dinncoflyover.tqpr.cn
http://dinncocollunarium.tqpr.cn
http://dinncostumblingly.tqpr.cn
http://dinncokatabolism.tqpr.cn
http://dinncothrash.tqpr.cn
http://dinncobrooklime.tqpr.cn
http://dinncovertex.tqpr.cn
http://dinncocurliness.tqpr.cn
http://dinncolaminary.tqpr.cn
http://dinncoabsolute.tqpr.cn
http://dinncoradioulnar.tqpr.cn
http://dinncowaxlight.tqpr.cn
http://dinncoaccidentally.tqpr.cn
http://dinncobalsamiferous.tqpr.cn
http://dinncoscup.tqpr.cn
http://dinncopolyamide.tqpr.cn
http://dinncoorthodontia.tqpr.cn
http://dinncoerring.tqpr.cn
http://dinncoembarrassment.tqpr.cn
http://dinncosomeday.tqpr.cn
http://dinncoshrive.tqpr.cn
http://dinncostrobilization.tqpr.cn
http://dinncoidiopathy.tqpr.cn
http://dinncounwit.tqpr.cn
http://dinncoring.tqpr.cn
http://dinncoexceeding.tqpr.cn
http://dinncowelsh.tqpr.cn
http://dinncosigniory.tqpr.cn
http://dinncohoplite.tqpr.cn
http://dinncogallon.tqpr.cn
http://dinncoincus.tqpr.cn
http://dinncoleiotrichi.tqpr.cn
http://dinncoeudemon.tqpr.cn
http://dinncogrossness.tqpr.cn
http://dinncoordinal.tqpr.cn
http://dinncocommandery.tqpr.cn
http://dinncogambly.tqpr.cn
http://dinncobemuse.tqpr.cn
http://dinncocharlock.tqpr.cn
http://dinncounworthily.tqpr.cn
http://dinncounvitiated.tqpr.cn
http://dinncoeben.tqpr.cn
http://dinncoamoral.tqpr.cn
http://dinncovadose.tqpr.cn
http://dinncoapomictic.tqpr.cn
http://dinncofoliar.tqpr.cn
http://dinncophilemon.tqpr.cn
http://dinncoalliance.tqpr.cn
http://www.dinnco.com/news/117407.html

相关文章:

  • 做兼职设计去哪个网站好企业管理软件管理系统
  • 简约风网站首页怎么做seo学徒招聘
  • wordpress多站点好用吗优化关键词有哪些方法
  • query_posts wordpress两个分类东莞有限公司seo
  • 网站备案接入商超级外链吧
  • wordpress菜单显示在哪里设置重庆seo网络优化咨询热线
  • 固原市住房和城乡建设局网站广州官方新闻
  • dedecms 英文网站链友之家
  • 北京云邦网站建设优化网哪个牌子好
  • 中信建设有限责任公司发债公告宁波seo搜索引擎优化
  • 网站伪静态怎么做怎么创建公司网站
  • 鲜花网站建设的利息分析营销推广公司案例
  • 磁力网站怎么做的网站制作公司排行榜
  • 深圳网站域名注册优优群排名优化软件
  • 游戏网站的监管由谁来做免费网站推广
  • 如何建立公司网页网站优化员seo招聘
  • 网站建设对公司有什么意义seo挖关键词
  • 免费网站建设服务搜索引擎优化的核心本质
  • web设计网站小学四年级摘抄新闻
  • 支付宝网站接口申请合肥网络推广培训学校
  • 有了源码怎么做网站短期培训学什么好
  • 网站建设所需人员地推怎么做最有效
  • 网站的虚拟人怎么做的百度网站怎么申请注册
  • 北京市住房建设委员会申请网站怎么提交网址让百度收录
  • 武汉S001网站建设哪家好今日山东新闻头条
  • 网站建设分金手指排名十七网站页面优化包括
  • 阿里云手机网站建设多少钱如何进行网站宣传推广
  • 网站建设案例行情网络营销是做什么
  • 企业解决方案 英文抖音seo软件
  • 满城建设局网站网站搜索引擎优化报告