Easy short cpp sol


#1
ListNode* Solution::deleteDuplicates(ListNode* A) {
    struct ListNode * ptr=A,*h=A;
    while(A)
    {
        while(ptr&&(ptr->val==A->val)) ptr=ptr->next;
        A->next=ptr,A=A->next;
    }
    return h;
}