其他分享
首页 > 其他分享> > leetcode-206-OK

leetcode-206-OK

作者:互联网

剑指 24
address

struct ListNode* reverseList(struct ListNode* head){
    if(head ==NULL)
        return head;
    struct ListNode * newhead = head, *p;
    head = head->next;
    newhead->next = NULL;
    while(head){
        p = head;
        head = head->next;
        p->next = newhead;
        newhead = p;
    }
    return newhead;
}

标签:head,OK,struct,206,next,return,ListNode,newhead,leetcode
来源: https://www.cnblogs.com/gallien/p/14301034.html