1条回答 默认 最新
- weixin_44803179 2021-02-24 21:35关注
struct ListNode* reverseList(struct ListNode* head)
{
struct ListNode* pre=head->next;
struct ListNode* mid=pre->next;
struct ListNode* las=mid->next;
pre->next=NULL;
while (las != NULL)
{
mid->next=pre;
pre=mid;
mid=las;
las=las->next;
}
mid->next=pre;
head->next=mid;
return head;
}
解决 无用评论 打赏 举报