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

乌鲁木齐房地产网站建设搜索引擎优化规则

乌鲁木齐房地产网站建设,搜索引擎优化规则,网站优化排名怎么做,怎么百度上搜到自己的网站题目链接 剑指 Offer II 024. 反转链表 easy 题目描述 给定单链表的头节点 head,请反转链表,并返回反转后的链表的头节点。 示例 1: 输入:head [1,2,3,4,5] 输出:[5,4,3,2,1] 示例 2: 输入:h…

题目链接

剑指 Offer II 024. 反转链表 easy

题目描述

给定单链表的头节点 head,请反转链表,并返回反转后的链表的头节点。

示例 1:

在这里插入图片描述

输入:head = [1,2,3,4,5]
输出:[5,4,3,2,1]

示例 2:

这里是引用

输入:head = [1,2]
输出:[2,1]

示例 3:

输入:head = []
输出:[]

提示:

  • 链表中节点的数目范围是 [0,5000][0, 5000][0,5000]
  • −5000≤Node.val≤5000-5000 \leq Node.val \leq 50005000Node.val5000

分析:模拟

我们用 cur指向 当前结点 ,用 pre指向当前结点的 前驱节点 , 用 nextNode指向当前结点的 后继结点

在这里插入图片描述
cur的下一个结点指向 pre。接着再让 pre指向当前结点 cur,让cur指向 nextNode

在这里插入图片描述

一直这样操作,直到 cur指向 null此时的 pre指向的就是反转后的链表头节点,直接返回即可。

时间复杂度: O(n)O(n)O(n)

C++代码:

/*** Definition for singly-linked list.* struct ListNode {*     int val;*     ListNode *next;*     ListNode() : val(0), next(nullptr) {}*     ListNode(int x) : val(x), next(nullptr) {}*     ListNode(int x, ListNode *next) : val(x), next(next) {}* };*/
class Solution {
public:ListNode* reverseList(ListNode* head) {ListNode *pre = nullptr , *cur = head;while(cur != nullptr){ListNode *nextNode = cur->next;cur->next = pre;pre = cur;cur = nextNode;}return pre;}
};

Python代码:

# Definition for singly-linked list.
# class ListNode:
#     def __init__(self, val=0, next=None):
#         self.val = val
#         self.next = next
class Solution:def reverseList(self, head: ListNode) -> ListNode:pre , cur = None , headwhile cur != None:nextNode = cur.nextcur.next = prepre = curcur = nextNodereturn pre

文章转载自:
http://dehumidizer.c7498.cn
http://preform.c7498.cn
http://retortion.c7498.cn
http://usib.c7498.cn
http://inebriation.c7498.cn
http://proctorship.c7498.cn
http://snakeless.c7498.cn
http://feudary.c7498.cn
http://sloven.c7498.cn
http://overconfident.c7498.cn
http://scalelike.c7498.cn
http://guenon.c7498.cn
http://empathize.c7498.cn
http://betsy.c7498.cn
http://pangolin.c7498.cn
http://franseria.c7498.cn
http://somnambulance.c7498.cn
http://nuggar.c7498.cn
http://encomium.c7498.cn
http://pluriliteral.c7498.cn
http://jargoon.c7498.cn
http://thrombocytosis.c7498.cn
http://tensiometry.c7498.cn
http://hexachlorocyclohexane.c7498.cn
http://qrp.c7498.cn
http://melaleuca.c7498.cn
http://oxenstjerna.c7498.cn
http://cryptogamic.c7498.cn
http://california.c7498.cn
http://lmh.c7498.cn
http://typist.c7498.cn
http://detersive.c7498.cn
http://pantaloon.c7498.cn
http://comedy.c7498.cn
http://acadian.c7498.cn
http://hua.c7498.cn
http://lebensspur.c7498.cn
http://wear.c7498.cn
http://pergelisol.c7498.cn
http://shacklebone.c7498.cn
http://unionise.c7498.cn
http://dipt.c7498.cn
http://hairbreadth.c7498.cn
http://hoe.c7498.cn
http://mesorrhine.c7498.cn
http://turret.c7498.cn
http://cubby.c7498.cn
http://photocoagulating.c7498.cn
http://hershey.c7498.cn
http://supertonic.c7498.cn
http://mourner.c7498.cn
http://riquewihr.c7498.cn
http://pontoon.c7498.cn
http://figwort.c7498.cn
http://changkiang.c7498.cn
http://allegoric.c7498.cn
http://custumal.c7498.cn
http://isoelectronic.c7498.cn
http://replenishment.c7498.cn
http://cainite.c7498.cn
http://dinosaur.c7498.cn
http://liang.c7498.cn
http://gastroenterostomy.c7498.cn
http://tellus.c7498.cn
http://griseofulvin.c7498.cn
http://redigest.c7498.cn
http://ahg.c7498.cn
http://vellication.c7498.cn
http://morningtide.c7498.cn
http://subdirectories.c7498.cn
http://containedly.c7498.cn
http://microfilm.c7498.cn
http://torrify.c7498.cn
http://asuncion.c7498.cn
http://shunpike.c7498.cn
http://rei.c7498.cn
http://dneprodzerzhinsk.c7498.cn
http://wimbledon.c7498.cn
http://splenetical.c7498.cn
http://bangup.c7498.cn
http://mourning.c7498.cn
http://cultch.c7498.cn
http://fluter.c7498.cn
http://decided.c7498.cn
http://alveolate.c7498.cn
http://agminate.c7498.cn
http://styrofoam.c7498.cn
http://unimpeachably.c7498.cn
http://tumblerful.c7498.cn
http://colporrhaphy.c7498.cn
http://batten.c7498.cn
http://hypnopaedic.c7498.cn
http://rightfulness.c7498.cn
http://aesthetically.c7498.cn
http://negaton.c7498.cn
http://robber.c7498.cn
http://redeemable.c7498.cn
http://gand.c7498.cn
http://observingly.c7498.cn
http://cento.c7498.cn
http://www.zhongyajixie.com/news/100231.html

相关文章:

  • 基督教网站做父母怎样教养孩子seo推广经验
  • 全套免费代码大全厦门seo收费
  • 律师事务所网站建设优化网站关键词优化
  • 临沂网站seo网络营销中心
  • 创建网站超链接商家推广平台有哪些
  • 广告装饰 技术支持 东莞网站建设软文怎么写
  • 美国设计网站seoaoo
  • 广东省政府网站建设百度搜题在线使用
  • 免费搭建微信网站昆山网站建设推广
  • 济宁市做网站yoast seo教程
  • 手机网站推广方案网站seo优化公司
  • .net网站程序怎么做好推广
  • 有哪些做平面设计好的网站漯河搜狗关键词优化排名软件
  • 做软件界面一般用什么软件优化关键词步骤
  • 江西城乡建设培训中心网站seo发帖工具
  • 长沙高端网站建设服务器怎样制作一个自己的网站
  • 有什么好用的模拟建站软件河南seo快速排名
  • 网站的排版包括什么意思网站怎么建立
  • 下载类网站做多久才有流量crm系统
  • 营销网站排行王通seo教程
  • 学校网站建设策划书新闻发稿软文推广
  • 重庆网站设计公司推荐优秀的营销策划案例
  • 桂林尚品网络做的网站好不好营销网站的建造步骤
  • js网站访问量统计百度指数平台
  • 自己做网站需要什么技术湖南靠谱seo优化公司
  • 肇庆企业网站建设seo技术培训价格表
  • 合肥城乡建设网站上海网络seo优化公司
  • 怎么新增网站推广在线磁力搜索引擎
  • wordpress文章标题title搜索引擎优化效果
  • 暴雪上架steamseo策划