ListNode* reverseList(ListNode* head) {
if(head== nullptr)
return head;
ListNode *rear= nullptr,*front=nullptr;
while(head!= nullptr){
front=head->next;
head->next=rear;
rear=head;
head=front;
}
return rear;
}
206 链表逆置
猜你喜欢
转载自www.cnblogs.com/INnoVationv2/p/10150426.html
今日推荐
周排行