当前位置:网站首页>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
边栏推荐
- leetcode——旋转数组的最小数字
- 8、数组中出现次数超过一半的数字
- Step 4 - user development environment settings
- Illustrate three mainstream enterprise architecture models (recommended collection!)
- Netease written test No. 2 -- typical application of European distance
- Tencent technical experts: decrypt the 100 million user products wechat, QQ, King glory... Comprehensively practice on the cloud!
- 什么样的知识付费系统功能,更有利于平台与讲师发展?
- 第四步-用户开发环境设置
- 排序——快速排序(快慢指针实现)
- LIBCMTD.lib
猜你喜欢

Choosing a supplier service system is the first step for large health industry enterprises to move towards digital transformation

ES(8.1)认证题目

ES (8.1) certification topic

初识SuperMap iDesktop

利用正则表达式从文件路径中匹配文件名

gcc: error trying to exec 'as': execvp: No such file or directory
![[esp32][esp idf][lvgl7.9] failed to compile with OLED IIC](/img/16/e5aa43df6ef9bdbc173fa547c85559.png)
[esp32][esp idf][lvgl7.9] failed to compile with OLED IIC
![[esp32][esp idf] ap+sta realizes wireless bridging and transferring WiFi signals](/img/bf/0a968064a8f7c11b86a2a2820208e6.png)
[esp32][esp idf] ap+sta realizes wireless bridging and transferring WiFi signals
![[learning notes] border and period](/img/a4/5493f7eefc7dd0e38bc9a53a92b87b.png)
[learning notes] border and period

配置树莓派,过程和遇到问题
随机推荐
Redis面试题必知必会
vc链接静态库的时候要注意的问题
网易笔试之不要二——欧式距离的典型应用
Go 内存模型 (2014年5月31日版本)
11、链表反转
Prometheus 运维工具 Promtool (四)TSDB 功能
头文件库文件
Kubernetes
吴雄昂遭Arm罢免内幕:建私人投资公司,损害了股东利益?
13、哈希表——两个链表第一个公共节点
Thinking and summary of technical personnel | R & D Efficiency
uni-app进阶之创建组件/原生渲染
多线程与高并发(三)—— 源码解析 AQS 原理
双指针技巧
简介
LIBCMTD.lib
Oracle中的小知识
用K-means聚类分类不同行业的关税模型
Status Notice ¶
C语言 二级指针详解及示例代码