My 4ms c solution


  • 0
    H
    struct ListNode* deleteDuplicates(struct ListNode* head) {
            struct ListNode *cur = head;
            while( cur && cur -> next ){
                struct ListNode *next = cur -> next;
                while(next && cur -> val == next -> val ){
                    cur -> next = next -> next;
                    next = next -> next;
                }
                cur = cur -> next;
            }
            return head;
        }

Log in to reply
 

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