python recursive & iterative, easy to understand, both beat 100%
recursive:\npython\nclass Solution:\n    def deleteDuplicates(self, head: \'ListNode\') -> \'ListNode\':\n        if not head or not head.next: return head\n   
recursive:\n```python\nclass Solution:\n    def deleteDuplicates(self, head: \'ListNode\') -> \'ListNode\':\n        if not head or not head.next: return head\n        nxt = head.next\n        if nxt.val != head.val:\n            head.next = self.deleteDuplicates(nxt)\n            return head\n        else:\n            while nxt and nxt.val == head.val:\n                nxt = nxt.next\n            return self.deleteDuplicates(nxt)\n```\niterative:\n```python\nclass Solution:\n    def deleteDuplicates(self, head: \'ListNode\') -> \'ListNode\':\n        dum = ListNode(0)\n        dum.next, pre, cur = head, dum, head\n        while cur:\n            while cur.next and cur.val == cur.next.val:\n                cur = cur.next\n            if pre.next == cur: \n                pre = cur\n            else: \n                pre.next = cur.next\n            cur = cur.next\n        return dum.next\n```
[]