多彩编程 多彩编程MZPH · CODE BLOG
ARTICLE DETAIL

文章详情

深耕前端与后端开发技术的一线实战笔记与踩坑复盘。

链表逆置

链表逆置 输入一个链表反转链表后输出新链表的表头。public class Solution { public ListNode ReverseList(ListNode head) { ListNode prenull; ListNode nextnull; while(head!null){ nexthead.next; head.nextpre; prehead; headnext; } return pre; } }
返回列表