My implements run 0ms :)


  • 1
    J
    struct ListNode* reverseList(struct ListNode* head) {
        struct ListNode* new_head = NULL;
        while(head) {
            struct ListNode* tmp = head->next;
            head->next = new_head;
            new_head = head;
            head = tmp;
        }
        return new_head;
    }

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.