A easy to understand python solution
\n\n    def deleteDuplicates(self, head):\n        # Add a dummy node point to the current list\n        newhead = ListNode(0)\n        newhead.next = head\n   
\n\n    def deleteDuplicates(self, head):\n        # Add a dummy node point to the current list\n        newhead = ListNode(0)\n        newhead.next = head\n        val_need_to_be_deleted = None\n        tail = newhead\n        \n        while head:\n            \n            # Triger delete mode if current has the same val as the next\n            if head and head.next and head.val == head.next.val:\n                val_need_to_be_deleted = head.val\n            \n            # Not a dup if delete mode is off or the current value doesn't match the value need to be deleted\n            if val_need_to_be_deleted == None or head.val != val_need_to_be_deleted:\n                # add it to the newlist\n                tail.next = head\n                tail = head\n                \n            head = head.next\n            \n        tail.next = None\n        return newhead.next
[]