leetcode-剑指 Offer 24. 反转链表 双指针 1234567891011121314class Solution { public ListNode reverseList(ListNode head) { if(head.next == null){ return head; } ListNode cur = head; ListNode pre = null; while(cur != null){ cur.next = pre; pre = cur; } }} 递归 1234567891011class Solution { public ListNode reverseList(ListNode head) { if(head == null || head.next == null){ return head; } ListNode res = reverseList(head.next); head.next.next = head; head.next = null; return res; }} 文章作者: 冬遇文章链接: https://liuheng0315.github.io/2020/10/19/leetcode/leetcode-%E5%89%91%E6%8C%87-Offer-24-%E5%8F%8D%E8%BD%AC%E9%93%BE%E8%A1%A8/版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 vampire`blogs!leetcode上一篇leetcode-143. 重排链表下一篇leetcode-61. 旋转链表 相关推荐 2020-10-14leetcode-1002. 查找常用字符 2021-04-01leetcode-1006. 笨阶乘 2021-02-19leetcode-1004. 最大连续1的个数 III 2021-04-26leetcode-1011. 在 D 天内送达包裹的能力 2020-10-24leetcode-1024. 视频拼接 2020-09-17leetcode-1025. 除数博弈 评论