Simple and clear c++ recursive solution
\n\n    class Solution {\n    public:\n        ListNode deleteDuplicates(ListNode head) {\n            if (!head) return 0;\n            if (!head->next) return
\n\n    class Solution {\n    public:\n        ListNode* deleteDuplicates(ListNode* head) {\n            if (!head) return 0;\n            if (!head->next) return head;\n            \n            int val = head->val;\n            ListNode* p = head->next;\n            \n            if (p->val != val) {\n                head->next = deleteDuplicates(p);\n                return head;\n            } else {\n                while (p && p->val == val) p = p->next;\n                return deleteDuplicates(p);\n            }\n        }\n    };
[]