当前位置:网站首页>11. Linked list inversion
11. Linked list inversion
2022-07-28 10:16:00 【[email protected]】
- Input : 1->2->3->4->5->NULL
Output : 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;
}
Running results 
版权声明
本文为[[email protected]]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/209/202207280958224242.html
边栏推荐
- [esp32][esp idf][lvgl7.9] failed to compile with OLED IIC
- leetcode076——数组中的第 k 大的数字
- Irregular area of OSPF, LSA and serial number
- 定了!就在7月30日!
- Cloudcompare & PCL matching point sampling consistency suppression
- Continue to write the greatest work based on modelarts [play with Huawei cloud]
- Voice chat app - how to standardize the development process?
- API 网关 APISIX 在Google Cloud T2A 和 T2D 的性能测试
- (1)机器学习概念总结
- Context values traps and how to avoid or mitigate these traps in go
猜你喜欢

Thinking and summary of technical personnel | R & D Efficiency

Guangzhou metro line 14 xinshixu station is under construction, and residents in Baiyun District are about to start a double line transfer mode!

Xiao Hei stands up again and looks at leetcode:653. Sum of two IV - enter BST

21. 合并两个有序链表

【JS高级】js之函数、重载、匿名函数、作用域及作用域链_03

Arthas tutorial

Digital transformation scheme of real estate: all-round digital intelligence system operation, helping real estate enterprises improve the effectiveness of management and control

What are the highlights of B2B2C system? How to help jewelry enterprises build an omni channel multi merchant mall management system

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

On July 13, 2021, we collapsed like this
随机推荐
Voice chat app - how to standardize the development process?
第四步-用户开发环境设置
[cloud co creation] enterprise digital transformation, Huawei cloud consulting is with you
What kind of knowledge payment system functions are more conducive to the development of the platform and lecturers?
leetcode——旋转数组的最小数字
5、动态规划---斐波那契数列
MySQL架构原理
软件设计师考前20问,注意啦!!
SuperMap iServer发布管理以及调用地图服务
Consul
16、字符串反转
6、双指针——递增数组两数之和与目标数相等
gcc: error trying to exec 'as': execvp: No such file or directory
数据库mysql基础
基于ModelArts续写最伟大的作品【玩转华为云】
Vulnerability analysis hevd-0x8.integeroverflow[win7x86]
In retaliation for the dismissal of the company, I changed all code comments of the project!
Illustrate three mainstream enterprise architecture models (recommended collection!)
记录一次idea中的父子项目修改project与module名称,亲测!
定了!就在7月30日!