单链表的反转

public static ListNode reveseList (ListNode head) {
// write code here
ListNode tmp=head.next;
ListNode newHead=reveseList(head.next);
tmp.next=head;
head.next=null;
return newHead;
}

posted @ 2020-08-21 14:18  soft.push("zzq")  Views(70)  Comments(0Edit  收藏  举报