Easy Python solution O(n) runtime

interview-questions
Tags: #<Tag:0x00007f18268771d0>

#1
    # @param A : head node of linked list
    # @return the head node in the linked list
    def deleteDuplicates(self, A):
        temp = A
        while temp:
            while temp.next and temp.val == temp.next.val:
                temp.next = temp.next.next
            temp = temp.next
        return A