Python in-place solution with dummy head node.
    \n    def deleteDuplicates(self, head):\n        dummy = pre = ListNode(0)\n        dummy.next = head\n        while head and head.next:\n            if hea
        \n    def deleteDuplicates(self, head):\n        dummy = pre = ListNode(0)\n        dummy.next = head\n        while head and head.next:\n            if head.val == head.next.val:\n                while head and head.next and head.val == head.next.val:\n                    head = head.next\n                head = head.next\n                pre.next = head\n            else:\n                pre = pre.next\n                head = head.next\n        return dummy.next
['Python']