Very simple solution 6 lines only C++


#1

ListNode* Solution::deleteDuplicates(ListNode* head) {

struct ListNode* current = head;
if (current == NULL)
return head;
while (current->next != NULL)
{
if (current->val == current->next->val)
current->next = current->next->next;
else
current = current->next;
}
return head;
}