当前位置:网站首页>11、链表反转
11、链表反转
2022-07-28 09:58:00 【[email protected]】
- 输入: 1->2->3->4->5->NULL
输出: 5->4->3->2->1->NULL
public ListNode reverseList(ListNode head) {
ListNode cur = null, pre = head;
while(pre != null){
ListNode t = pre.next;
pre.next = cur;
cur = pre;
pre = t;
}
return cur;
}
运行结果
版权声明
本文为[[email protected]]所创,转载请带上原文链接,感谢
https://blog.csdn.net/zjj1910066023/article/details/124717991
边栏推荐
- API 网关 APISIX 在Google Cloud T2A 和 T2D 的性能测试
- ASP.NET Core 6框架揭秘实例演示[29]:搭建文件服务器
- Oracle中的小知识
- Guangzhou metro line 14 xinshixu station is under construction, and residents in Baiyun District are about to start a double line transfer mode!
- office2013以上输入数学公式
- CGAL编译错误
- 【JS高级】js之函数、重载、匿名函数、作用域及作用域链_03
- [cloud co creation] enterprise digital transformation, Huawei cloud consulting is with you
- JWT login authentication + token automatic renewal scheme, well written!
- Introduction to timebasedrollingpolicy
猜你喜欢

博弈论 1.Introduction(组合游戏基本概念、对抗搜索、Bash游戏、Nim游戏)

Flink - checkpoint Failure reason: Not all required tasks are currently running

Weekly report on July 27, 2022

7、二分法——寻找一组重复或者有序但是旋转的数组

工业品MRO采购网站有哪些优势?一文带你读懂

Redis面试题必知必会

深度学习必懂的 13 种概率分布

2021.07.13 我们是这样崩的

为什么要考一级建造师,一建证书含金量有多高?

Skillfully use NGX_ Lua makes traffic grouping
随机推荐
技术人 | 研发效能的思考总结
Introduction to timebasedrollingpolicy
腾讯技术专家:解密亿级用户产品 微信、QQ、王者荣耀...全面上云实践!
Openatom openharmony sub forum, see you today at 14:00! Wonderful release of memorabilia attached
Function introduction and description of @jsontype annotation in fastjson
JS promotion: the underlying principle of flat tiling
[jzof] 14 cut rope
Boss: there are too many systems in the company. Can we realize account interworking?
Status Notice ¶
[learning notes] border and period
Which strings will be resolved to null by fastjason?
记录一次idea中的父子项目修改project与module名称,亲测!
TCP Basics
海量数据TopN问题
ASP. Net core 6 framework unveiling example demonstration [29]: building a file server
JWT login authentication + token automatic renewal scheme, well written!
工业品MRO采购网站有哪些优势?一文带你读懂
19. 删除链表的倒数第 N 个结点
【云驻共创】企业数字化转型,华为云咨询与你同行
数据库mysql基础