Clean Python Solution

  • 0

    Look for a valid next node for the current node

    class Solution(object):
        def deleteDuplicates(self, head):
            curr = head
            while curr:
                next =
                while next and next.val == curr.val:
                    next =
       = next
                curr =
            return head

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.