11.17

struct ListNode *reverse(struct ListNode *head){
struct ListNode *prev=NULL;
struct ListNode *curr=head;
struct ListNode *next=NULL;
while(curr!=NULL){
next=curr->next;
curr->next=prev;
prev=curr;
curr=next;
}
return prev;
}

posted @ 2025-11-24 09:28  Cx330。  阅读(3)  评论(0)    收藏  举报