Python Compile Error -- please ignore the class indent.

  • 0
    import collections  class Solution:
    # @param head, a ListNode
    # @return a ListNode
    def deleteDuplicates(self, head):
        node = head
        lst = []
        while node is not None:
            node =
        return list(collections.OrderedDict.fromkeys(lst))

  • 0

    Do not import anything by yourself, like import collections.

    You can assume all necessary libraries are already imported, and if anything you really want and cannot get rid of it, please email and describe the situation, we might consider add it.

    BTW, I believe such solution of this problem like yours is too simple to accept by interviewers.

Log in to reply

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