ListNode* reverseList(ListNode* head) {
if(!head || !head->next){
return head;
}
ListNode* temp=reverseList(head->next);
head->next->next=head;
head->next=nullptr;
return temp;
}
链表反转——递归
最新推荐文章于 2022-11-25 01:07:00 发布