链表反转——递归
·
ListNode* reverseList(ListNode* head) {
if(!head || !head->next){
return head;
}
ListNode* temp=reverseList(head->next);
head->next->next=head;
head->next=nullptr;
return temp;
}
更多推荐



所有评论(0)