Python recursion, no dummy, one pointer, easy to understand

  • 0
    class Solution(object):
        def deleteDuplicates(self, head):
            if head == None: return None
            node = head
            flag = 0
            while and node.val ==
                flag = 1
   = self.deleteDuplicates(
            return head if not flag else 

Log in to reply

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