ListNode* reverseList(ListNode* head) {
ListNode* tail=NULL;
ListNode* front=head;
ListNode* curr=NULL;
//先令curr指向front,front移动下一个,curr的next指向tail实现反转
//再移动tail
while(front!=NULL){
curr=front;
front=front->next;
curr->next=tail;
tail=curr;
}
return tail;
}
标签:ListNode,反转,next,链表,tail,front,curr,NULL
From: https://www.cnblogs.com/lwx11111/p/16757338.html