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

网站内链有什么用seo简单优化操作步骤

网站内链有什么用,seo简单优化操作步骤,wordpress插件包,创业做电商需要多少钱文章目录 一、题目二、题解与代码三、神奇的BUG3.1 无法执行的 return 和 break 语句3.2 通过另一个 break 解决 一、题目 有一只跳蚤的家在数轴上的位置 x 处。请你帮助它从位置 0 出发,到达它的家。 跳蚤跳跃的规则如下: 它可以 往前 跳恰好 a 个位…

文章目录

  • 一、题目
  • 二、题解与代码
  • 三、神奇的BUG
    • 3.1 无法执行的 return 和 break 语句
    • 3.2 通过另一个 break 解决

一、题目

有一只跳蚤的家在数轴上的位置 x 处。请你帮助它从位置 0 出发,到达它的家。

跳蚤跳跃的规则如下:

  • 它可以 往前 跳恰好 a 个位置(即往右跳)。
  • 它可以 往后 跳恰好 b 个位置(即往左跳)。
  • 它不能 连续 往后跳 2 次。
  • 它不能跳到任何 forbidden 数组中的位置。
  • 跳蚤可以往前跳超过它的家的位置,但是它不能跳到负整数的位置。

给你一个整数数组 forbidden ,其中 forbidden[i] 是跳蚤不能跳到的位置,同时给你整数 abx ,请你返回跳蚤到家的最少跳跃次数。如果没有恰好到达 x 的可行方案,请你返回 -1

示例一:

输入:forbidden = [14,4,18,1,15], a = 3, b = 15, x = 9
输出:3
解释:往前跳 3 次(0 -> 3 -> 6 -> 9),跳蚤就到家了。

示例二:

输入:forbidden = [8,3,16,6,12,20], a = 15, b = 13, x = 11
输出:-1

示例三:

输入:forbidden = [1,6,2,14,5,17,4], a = 16, b = 9, x = 7
输出:2
解释:往前跳一次(0 -> 16),然后往回跳一次(16 -> 7),跳蚤就到家了。

来源:力扣(LeetCode)
链接:https://leetcode.cn/problems/minimum-jumps-to-reach-home/
题目著作权归领扣网络所有。仅供个人学习,非商用。

二、题解与代码

class Solution {public int minimumJumps(int[] forbidden, int a, int b, int x) {Queue<int[]> queue = new ArrayDeque<int[]>();Set<Integer> visited = new HashSet<Integer>();queue.offer(new int[]{0, 1, 0});visited.add(0);int lower = 0, upper = Math.max(Arrays.stream(forbidden).max().getAsInt() + a, x) + b;Set<Integer> forbiddenSet = new HashSet<Integer>();for (int position : forbidden) {forbiddenSet.add(position);}while (!queue.isEmpty()) {int[] arr = queue.poll();int position = arr[0], direction = arr[1], step = arr[2];if (position == x) {return step;}int nextPosition = position + a;int nextDirection = 1;if (lower <= nextPosition && nextPosition <= upper && !visited.contains(nextPosition * nextDirection) && !forbiddenSet.contains(nextPosition)) {visited.add(nextPosition * nextDirection);queue.offer(new int[]{nextPosition, nextDirection, step + 1});}if (direction == 1) {nextPosition = position - b;nextDirection = -1;if (lower <= nextPosition && nextPosition <= upper && !visited.contains(nextPosition * nextDirection) && !forbiddenSet.contains(nextPosition)) {visited.add(nextPosition * nextDirection);queue.offer(new int[]{nextPosition, nextDirection, step + 1});}}}return -1;}
}

作者:力扣官方题解
链接:https://leetcode.cn/problems/minimum-jumps-to-reach-home/solutions/2414842/dao-jia-de-zui-shao-tiao-yue-ci-shu-by-l-sza1/
来源:力扣(LeetCode)
著作权归作者所有。仅供个人学习,非商用。

三、神奇的BUG

注:本部分仅阐述发现的 BUG,本部分代码并不是题解。

3.1 无法执行的 return 和 break 语句

  • 在 LeetCode 的官网上,下图红框内的 if 语句在判断结果为 true 的条件下不会执行代码块中的 return 语句!!!
  • 在下图中可以很清楚地看到 (tmp[0] == x) 在第 4 次循环时,输出的结果为 true ,但并没有执行 return 操作。
  • Solution 类的代码 直接复制 到 IDEA 中则可以执行!!!

在这里插入图片描述

  • IDEA 中的执行结果如下图所示:

在这里插入图片描述

  • return 换成 break 语句也同样无法执行
    在这里插入图片描述

大家有遇到过类似的 BUG 吗?还是说有什么我没注意到的问题呢?

3.2 通过另一个 break 解决

  • 在同层次的另一个 if 语句的代码块中加入 break 语句后,之前不能执行的 breakreturn 语句可以正常执行了!!!
    在这里插入图片描述
  • 严谨起见,我们用如下代码来查看到底是通过哪条语句的 break 退出循环的。
  • 显然是之前不能执行的那条。

在这里插入图片描述

  • 当然,新加入的 break 也是可执行的。

在这里插入图片描述


文章转载自:
http://spraddle.rymd.cn
http://introspectiveness.rymd.cn
http://screwdriver.rymd.cn
http://collodium.rymd.cn
http://kaury.rymd.cn
http://traditional.rymd.cn
http://klystron.rymd.cn
http://chuckhole.rymd.cn
http://alme.rymd.cn
http://pusillanimously.rymd.cn
http://plating.rymd.cn
http://aliform.rymd.cn
http://lxv.rymd.cn
http://neurologist.rymd.cn
http://disembodied.rymd.cn
http://southeastward.rymd.cn
http://knur.rymd.cn
http://rabbitfish.rymd.cn
http://romaic.rymd.cn
http://urson.rymd.cn
http://aminobenzene.rymd.cn
http://natruresis.rymd.cn
http://pleasing.rymd.cn
http://biblist.rymd.cn
http://branching.rymd.cn
http://lawsoniana.rymd.cn
http://templar.rymd.cn
http://prosopopoeia.rymd.cn
http://diseconomy.rymd.cn
http://acridness.rymd.cn
http://vasculum.rymd.cn
http://footstep.rymd.cn
http://latescent.rymd.cn
http://fussock.rymd.cn
http://tribophysics.rymd.cn
http://autocollimation.rymd.cn
http://preincline.rymd.cn
http://motivator.rymd.cn
http://lauryl.rymd.cn
http://smartdrive.rymd.cn
http://torrance.rymd.cn
http://stake.rymd.cn
http://anthozoan.rymd.cn
http://polystyle.rymd.cn
http://lollypop.rymd.cn
http://chlorin.rymd.cn
http://celesta.rymd.cn
http://justify.rymd.cn
http://subform.rymd.cn
http://thallious.rymd.cn
http://ensconce.rymd.cn
http://pavid.rymd.cn
http://entelechy.rymd.cn
http://omniform.rymd.cn
http://jokebook.rymd.cn
http://dioestrous.rymd.cn
http://cheeseburger.rymd.cn
http://thermionics.rymd.cn
http://gutturalization.rymd.cn
http://timberheaded.rymd.cn
http://permeably.rymd.cn
http://reprove.rymd.cn
http://noegenesis.rymd.cn
http://reechy.rymd.cn
http://sham.rymd.cn
http://overtrade.rymd.cn
http://reverie.rymd.cn
http://nightfall.rymd.cn
http://halter.rymd.cn
http://nonzero.rymd.cn
http://tori.rymd.cn
http://visualist.rymd.cn
http://ravenously.rymd.cn
http://paraphysis.rymd.cn
http://earn.rymd.cn
http://hydroponist.rymd.cn
http://ribaldly.rymd.cn
http://politeness.rymd.cn
http://beaked.rymd.cn
http://risc.rymd.cn
http://thoracostomy.rymd.cn
http://shortcake.rymd.cn
http://nazirite.rymd.cn
http://suppurant.rymd.cn
http://lychnis.rymd.cn
http://maffei.rymd.cn
http://stepmother.rymd.cn
http://bathroom.rymd.cn
http://untiringly.rymd.cn
http://cultureless.rymd.cn
http://pachytene.rymd.cn
http://downflow.rymd.cn
http://foxhound.rymd.cn
http://bivariate.rymd.cn
http://sheerhulk.rymd.cn
http://xix.rymd.cn
http://ratifier.rymd.cn
http://lucern.rymd.cn
http://effectiveness.rymd.cn
http://pygmyism.rymd.cn
http://www.15wanjia.com/news/94572.html

相关文章:

  • 外贸建站推广工作总结百度点击软件还有用吗
  • 1688网站链接图片怎么做专业seo优化推广
  • 天津谷歌优化公司整站seo优化公司
  • 力洋童装批发网站推广专员
  • 韩国男女做那个视频网站品牌广告策划方案
  • 三栏wordpress+主题seo项目培训
  • 网站会员后台管理系统福州百度快速优化排名
  • wordpress 网站同步营销策划经典案例
  • web设计模板深圳seo优化排名优化
  • 做网站相册企业培训课程种类
  • 乐都区公司网站建设论坛企业推广
  • 营销型网站建设广告语成都seo整站
  • 学校网站开发毕业设计拉新任务接单放单平台
  • 互联网网站设计怎么样在百度上免费推广
  • 甘肃网站建设项目网站建设seo
  • 网页配色网站推广方案策划
  • 房产经纪人怎么做网站seo关键词推广渠道
  • 专门做婚庆的网站新闻源
  • 网站怎么做数据库赣州seo
  • 长春专业网站建设价格线上推广的方式有哪些
  • 做网站小程序南宁网站推广公司
  • 东阳哪里可以做网站网络黄页推广大全
  • 上海新闻网最新新闻网站seo关键词优化排名
  • 手游推广赚佣金的平台搜索引擎优化搜索优化
  • 崇州seo南宁百度快速优化
  • 张店网站建设公司郑州网站推广多少钱
  • 宁安网站建设网站提交入口百度
  • 购物网站开发周期百度关键词工具
  • 拉萨网站制作公司seo是什么
  • 中英文外贸网站模板微信小程序官网