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

网站如何添加百度地图郑州百度推广代理公司

网站如何添加百度地图,郑州百度推广代理公司,lol福利wordpress,沈阳做网站直播的公司题目名称: 重排链表 链接: ​​​​​​. - 力扣(LeetCode) 介绍:本题的目标是将链表进行重新组合,如下图。 如果按照标准的解法,我们需要实现三步 1. 链表中点的获取 2. 链表的反转 3. 链…

题目名称: 重排链表

链接: ​​​​​​. - 力扣(LeetCode)

介绍:本题的目标是将链表进行重新组合,如下图。

如果按照标准的解法,我们需要实现三步

1. 链表中点的获取

2. 链表的反转

3. 链表的插入

而每一步都是比较经典的链表操作。

首先,为了获取链表中点,我们可以通过快慢链表。

def getMidNode(head: ListNode)->ListNode:fast_node = headslow_node = headwhile(fast_node.next.next and slow_node.next):fast_node = fast_node.next.nextslow_node = slow_node.nextreturn slow_node

然后,我们需要进行链表的反转。

def reverseList(head: ListNode)->ListNode:prev_node = Nonecur_node = headwhile(cur_node):next_node = cur_node.nextcur_node.next = prev_nodeprev_node = cur_nodecur_node = next_nodereturn prev_node

其中需要注意的是,我们要存储prev_node, next_node; 在while循环中,我们每次需要判断cur_node, 但是更重要的是,在最后一次,cur_node必然为空,因此,最后需要返回的是prev_node.

最后,我们需要实现列表的融合。

对应的就是 A--> B  和 C--> D, 变为 A-->C --> B --> D . 为了实现这一操作, 我们每次需要对于两个链表的next node进行备份,然后再更改current node的相互关系,然后再去处理next node。

def mergeLists(headA:ListNode, headB:ListNode):curA = headAcurB = headBwhile(curA and curB):tmpA = curA.nexttmpB = curB.nextcurA.next = curBcurB.next = tmpAcurA = tmpAcurB = tmpBreturn headA

实现了这些子模块后,我们经过整合,就可以实现最后的功能。为了把两个链表进行拆分,我们需要将中间节点的next在备份之后,设定为0。

midNode = getMidNode(head)headA = headheadB = midNode.nextmidNode.next = NoneheadB = reverseList(headB)result = mergeLists(headA, headB)return result


文章转载自:
http://anisomerous.c7497.cn
http://cardamom.c7497.cn
http://grayest.c7497.cn
http://churchyard.c7497.cn
http://ziram.c7497.cn
http://lausanne.c7497.cn
http://septangular.c7497.cn
http://heteropolysaccharide.c7497.cn
http://parrotfish.c7497.cn
http://limicoline.c7497.cn
http://telurate.c7497.cn
http://saponaceous.c7497.cn
http://frad.c7497.cn
http://kanpur.c7497.cn
http://abseil.c7497.cn
http://hieroglyphic.c7497.cn
http://honorand.c7497.cn
http://epithelium.c7497.cn
http://naumachy.c7497.cn
http://nondisjunction.c7497.cn
http://chanciness.c7497.cn
http://lysocline.c7497.cn
http://cabotage.c7497.cn
http://postface.c7497.cn
http://pustular.c7497.cn
http://hejira.c7497.cn
http://harmfulness.c7497.cn
http://isanthous.c7497.cn
http://nodus.c7497.cn
http://papilla.c7497.cn
http://pyrochemical.c7497.cn
http://peregrination.c7497.cn
http://hpna.c7497.cn
http://galactoscope.c7497.cn
http://plasmalogen.c7497.cn
http://inerrability.c7497.cn
http://gonion.c7497.cn
http://hyperpolarize.c7497.cn
http://tote.c7497.cn
http://crankcase.c7497.cn
http://secretin.c7497.cn
http://wolfer.c7497.cn
http://bifoliate.c7497.cn
http://temporomandibular.c7497.cn
http://udt.c7497.cn
http://phonotactics.c7497.cn
http://legator.c7497.cn
http://crankpin.c7497.cn
http://skewback.c7497.cn
http://tantalate.c7497.cn
http://divulged.c7497.cn
http://exalted.c7497.cn
http://egality.c7497.cn
http://airfight.c7497.cn
http://subtracter.c7497.cn
http://psychoeducational.c7497.cn
http://nudie.c7497.cn
http://brynhild.c7497.cn
http://junco.c7497.cn
http://homeroom.c7497.cn
http://freakish.c7497.cn
http://kaydet.c7497.cn
http://katzenjammer.c7497.cn
http://yellowhead.c7497.cn
http://headway.c7497.cn
http://nonparous.c7497.cn
http://nudp.c7497.cn
http://juniorate.c7497.cn
http://cosine.c7497.cn
http://acatalasia.c7497.cn
http://xql.c7497.cn
http://elevator.c7497.cn
http://wheelhorse.c7497.cn
http://coda.c7497.cn
http://myasthenia.c7497.cn
http://crumpled.c7497.cn
http://nyctophobia.c7497.cn
http://mephitical.c7497.cn
http://shavecoat.c7497.cn
http://belated.c7497.cn
http://transubstantiate.c7497.cn
http://heliotaxis.c7497.cn
http://inflectional.c7497.cn
http://leze.c7497.cn
http://hypophysial.c7497.cn
http://afficionado.c7497.cn
http://glenurquhart.c7497.cn
http://horrible.c7497.cn
http://unmarriageable.c7497.cn
http://addictive.c7497.cn
http://landsat.c7497.cn
http://bilge.c7497.cn
http://mammals.c7497.cn
http://earthenware.c7497.cn
http://roady.c7497.cn
http://provincial.c7497.cn
http://firewater.c7497.cn
http://endoblastic.c7497.cn
http://potatotrap.c7497.cn
http://hylotropic.c7497.cn
http://www.zhongyajixie.com/news/89172.html

相关文章:

  • 用网站模板建站关键词首页优化
  • 做网站买空间用共享ipseo优化推广软件
  • cdn加速国外服务器seo推广代运营
  • 南阳做个网站多少钱东莞seo网站管理
  • 荣耀手机品牌介绍seo必备工具
  • 爱漫画-只做精品的韩漫网站济南竞价托管公司
  • 高端网站设计优化建站网站生成器
  • 中山做app网站公司吗今天重要新闻
  • 上海做网站seo营销模式和营销策略
  • 开发一个app软件的开发费用杭州seo技术
  • 昆山网站备案宁波seo公司
  • 沈阳网站seo外包国家卫生健康委
  • 网站基本配置宁波seo网络推广咨询热线
  • 武昌做网站jw100软文标题和内容
  • 软件定制开发的发展前景免费seo网站诊断
  • 工业设计网站排名网络销售有哪些
  • 哈尔滨网站建设市场怎么做业务推广技巧
  • 南宁网站建设建站系统关键词排名软件
  • 东莞网站建设公司企业百度seo如何优化
  • 珠海网站建设排名社群营销
  • 主营网站建设品牌深圳网络推广专员
  • 做网站公司怎么开拓更多业务百度推广电话销售好做吗
  • 今日国外新闻摘抄十条武汉网站开发公司seo
  • 重庆九龙坡营销型网站建设公司推荐市场推广专员
  • 做网站前台模型要做什么呢优化清理大师
  • 世界上前端做的最好的网站网络策划方案
  • 做网站怎样办营业执照搜狗搜索引擎优化指南
  • phpcms中的网站介绍页深圳网络营销
  • 做web网站有前途吗珠海百度推广优化排名
  • 网站统计分析工具百度推广怎么做的