Less than 10 lines C++ solution, O(N)


#1
ListNode* Solution::deleteDuplicates(ListNode* A) {
    ListNode* pnt = A;
    while (pnt != nullptr) {
        if (pnt->next != nullptr && pnt->next->val == pnt->val) {
            pnt->next = pnt->next->next;
        } else {
            pnt = pnt->next;
        }
    }
    return A;
}