Self explanatory C++ soln (Very easy)


#1
ListNode* Solution::deleteDuplicates(ListNode* A) {
    ListNode *prev = A;
    ListNode *curr = A->next;
    
    while(curr != NULL){
        if(prev->val == curr->val){
            prev->next = curr->next;
            curr = curr->next;
        } else {
            prev = curr;
            curr = curr->next;
        }
    }
    return A;
}