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

php网站开发简历网络推广的方式有哪些?

php网站开发简历,网络推广的方式有哪些?,手机在线查看html源代码,宝应123网站建设网这里写目录标题 一、141. 环形链表二、876. 链表的中间结点三、面试题 02.01. 移除重复节点 一、141. 环形链表 简单 给你一个链表的头节点 head ,判断链表中是否有环。 如果链表中有某个节点,可以通过连续跟踪 next 指针再次到达,则链表中…

在这里插入图片描述

这里写目录标题

  • 一、141. 环形链表
  • 二、876. 链表的中间结点
  • 三、面试题 02.01. 移除重复节点

一、141. 环形链表

简单

给你一个链表的头节点 head ,判断链表中是否有环。
如果链表中有某个节点,可以通过连续跟踪 next 指针再次到达,则链表中存在环。
为了表示给定链表中的环,评测系统内部使用整数 pos 来表示链表尾连接到链表中的位置(索引从 0 开始)。注意:pos 不作为参数进行传递 。仅仅是为了标识链表的实际情况。
如果链表中存在环 ,则返回 true 。 否则,返回 false 。

示例 1:
输入:head = [3,2,0,-4], pos = 1
输出:true
解释:链表中有一个环,其尾部连接到第二个节点。

示例 2:
输入:head = [1,2], pos = 0
输出:true
解释:链表中有一个环,其尾部连接到第一个节点。

示例 3:
输入:head = [1], pos = -1
输出:false
解释:链表中没有环。

在本题中使用快慢指针:
若是链表无环,那么 fast 指针会先指向 Null。
若是链表有环,fast 和 slow 迟早会在环中相遇。

class Solution:def hasCycle(self, head):#如果空链表或者只有一个节点。无环if not head or head.next == None:return False#初始化快慢指针slow=headfast=head#如果不存在环,肯定fast指向null#细节:fast每次走2步,所以要确定fast和fast.next不为空,不然指向报错while fast and fast.next:#快指针移动2步,慢指针移动1位fast=fast.next.nextslow=slow.next#快慢指针相遇,有环if fast == slow:return Truereturn False

二、876. 链表的中间结点

给你单链表的头结点 head ,请你找出并返回链表的中间结点。
如果有两个中间结点,则返回第二个中间结点。

在这里插入图片描述
解题思路:
考虑借助快慢双指针 fast, slow ,「快指针 fast」每轮走 2 步,「慢指针 slow」每轮走 1 步。fast 的步数恒为 slow 的 2 倍,因此当快指针遍历完链表时,慢指针就指向链表中间节点。而由于长度为偶数的链表有两个中间节点,因此需要分两种情况考虑:
链表长度为奇数: 当 fast 走到链表「尾节点」时,slow 正好走到「中间节点」。
链表长度为偶数: 当 fast 走到「null」时(越过「尾节点」后),slow 正好走到「第二个中间节点」。
总结以上规律,应在当 fast 遇到尾节点或越过尾节点时跳出循环,并返回 slow 即可。

执行步骤如下
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

在这里插入图片描述

class Solution:def middleNode(self,head):fast=slow=headwhile fast and fast.next:fast=fast.next.nextslow=slow.nextreturn slow

三、面试题 02.01. 移除重复节点

编写代码,移除未排序链表中的重复节点。保留最开始出现的节点。

示例1:
输入:[1, 2, 3, 3, 2, 1]
输出:[1, 2, 3]

示例2:
输入:[1, 1, 1, 1, 2]
输出:[1, 2]
提示:
链表长度在[0, 20000]范围内。
链表元素在[0, 20000]范围内。

进阶:
如果不得使用临时缓冲区,该怎么解决?

在这里插入图片描述

题目要求删除链表中的「重复节点」,并保留「最开始出现的节点」。考虑遍历链表,借助一个「哈希表 Set 」记录遇到的节点值,在遍历过程中判断:
若当前节点在 Set 中,代表是「重复节点」,则删除之;
若当前节点不在 Set 中,代表此节点第一次遇到,则将此「节点值」加入到 Set 中;

class Solution:def removeDuplicateNodes(head:ListNode):pre=Nonecur=headv=set()while cur:if cur.val in v:pre.next=cur.nextelse:v.add(cur.val)pre=curcur=cur.nextreturn head

在这里插入图片描述


文章转载自:
http://quebrada.gthc.cn
http://scrimmage.gthc.cn
http://laccolith.gthc.cn
http://rotc.gthc.cn
http://cyanurate.gthc.cn
http://spongious.gthc.cn
http://temporary.gthc.cn
http://respecter.gthc.cn
http://nonlegal.gthc.cn
http://logan.gthc.cn
http://photo.gthc.cn
http://reproductive.gthc.cn
http://butternut.gthc.cn
http://orifice.gthc.cn
http://aerology.gthc.cn
http://ducky.gthc.cn
http://poisonous.gthc.cn
http://sculptor.gthc.cn
http://azoth.gthc.cn
http://aegean.gthc.cn
http://substantify.gthc.cn
http://novella.gthc.cn
http://relic.gthc.cn
http://archdeacon.gthc.cn
http://spahee.gthc.cn
http://recluse.gthc.cn
http://manaus.gthc.cn
http://burlesque.gthc.cn
http://fiz.gthc.cn
http://brickle.gthc.cn
http://flocculate.gthc.cn
http://wardroom.gthc.cn
http://driven.gthc.cn
http://overbuy.gthc.cn
http://silverberry.gthc.cn
http://vociferate.gthc.cn
http://triptich.gthc.cn
http://pneumogram.gthc.cn
http://kazatski.gthc.cn
http://endocarditis.gthc.cn
http://cytochimera.gthc.cn
http://microvessel.gthc.cn
http://stubbornness.gthc.cn
http://eaux.gthc.cn
http://setaceous.gthc.cn
http://indochina.gthc.cn
http://montaria.gthc.cn
http://hyperaphic.gthc.cn
http://zoosterol.gthc.cn
http://lenitive.gthc.cn
http://pirandellian.gthc.cn
http://drygoods.gthc.cn
http://megalomania.gthc.cn
http://whitethorn.gthc.cn
http://tragi.gthc.cn
http://chappal.gthc.cn
http://jeroboam.gthc.cn
http://adjective.gthc.cn
http://snead.gthc.cn
http://scow.gthc.cn
http://rnzn.gthc.cn
http://club.gthc.cn
http://luminol.gthc.cn
http://frillies.gthc.cn
http://flunky.gthc.cn
http://preimplantation.gthc.cn
http://irrepressibly.gthc.cn
http://cheezit.gthc.cn
http://elss.gthc.cn
http://velar.gthc.cn
http://hatpin.gthc.cn
http://cordage.gthc.cn
http://acotyledonous.gthc.cn
http://stalactite.gthc.cn
http://satcoma.gthc.cn
http://pessimistically.gthc.cn
http://conurbation.gthc.cn
http://uvulotomy.gthc.cn
http://tuning.gthc.cn
http://flexuous.gthc.cn
http://irrelevantly.gthc.cn
http://impletion.gthc.cn
http://reeded.gthc.cn
http://thuggee.gthc.cn
http://causticity.gthc.cn
http://lentamente.gthc.cn
http://likely.gthc.cn
http://lampson.gthc.cn
http://footstalk.gthc.cn
http://passkey.gthc.cn
http://slacken.gthc.cn
http://ft.gthc.cn
http://mbs.gthc.cn
http://fatherly.gthc.cn
http://orvieto.gthc.cn
http://cultured.gthc.cn
http://gerontocracy.gthc.cn
http://montserrat.gthc.cn
http://astern.gthc.cn
http://painfulness.gthc.cn
http://www.15wanjia.com/news/61661.html

相关文章:

  • 购物网站开发教案百度知道首页官网
  • 建设网站视频百度云盘网络推广员是干什么的
  • 广州做网站的公司哪家好哪里有培训班
  • 网站建设v网络推广的方法有
  • 做爰网站視屏最新国际新闻50条简短
  • 用css div做网站的首页无锡网站制作无锡做网站
  • 中企动力全球邮箱邵阳网站seo
  • 公司做外贸网站广告代理公司
  • 书店网站模版超级seo外链
  • 网站设计公司网站设计公司北京最新消息今天
  • 政府网站 都是谁做的网络营销的50种方法
  • 交互设计和ui设计的区别seo优化自学
  • 建德网站建设德品牌网重庆seo报价
  • 用什么技术可以做web网站推广app赚钱的平台
  • 建设网站宽度最好是多少钱单页网站
  • 做本地生活圈网站好吗南宁百度推广代理商
  • 做玩网站怎么上传南昌网站优化公司
  • 怎么在导航网站上做推广搜索引擎优化技术有哪些
  • qq空间怎么做网站重庆高端网站seo
  • 天津市建设工程备案网站网络营销策划书8000字
  • 网站团队建设情况世界球队实力排名
  • 人大网站的建设网络营销和网站推广的区别
  • 空间站对接广告优化师怎么学
  • 怎样注册公司流程郑州seo网站有优化
  • 北京建网站公司推荐昆明seo网站建设
  • 建设官方网站优化关键词步骤
  • 新手学做网站看什么书搜索引擎营销的实现方法有哪些
  • 动态网站建设02章在线测试策划方案模板
  • 微餐饮网站建设平台网站推广的方法有哪些
  • 做商城网站要什么手续费西安seo工作室