力扣206
https://leetcode-cn.com/problems/reverse-linked-list/
简单题,链表题指针不怕多!!
1234567891011
public ListNode reverseList(ListNode head) { if (head == null) return null; ListNode pre = head, post = null, temp = null; while (pre != null) { temp = pre.next; pre.next = post; post = pre; pre = temp; } return post;}
其他链表类型的题目点击这里
wjwABCDEFG
Shaoguan, China
文章
102
分类
14
标签
26
游戏和引擎
生活随笔
数据结构和算法
Update your browser to view this website correctly. Update my browser now
×