public class Solution {
public ListNode ReverseList(ListNode head) {
ListNode result=null;
ListNode cur=head;
while(cur!=null)//一直给新链表做头插
{
ListNode next=cur.next;
cur.next=result;
result=cur;
cur=next;
}
return result;
}
}
【牛客网】反转链表
猜你喜欢
转载自blog.csdn.net/chris__x/article/details/104596655
今日推荐
周排行