• + 0 comments

    My solution in Python 3 using dictionary

    def removeDuplicates(self,head):
        d = {}
        cur = n = head
    
        while n is not None:
            if n.data not in d.keys():
                d[n.data] = True
                cur = n
            else:
                cur.next = n.next
            n = n.next
        return head