83. Remove Duplicates from Sorted List

class Solution(object):
    def deleteDuplicates(self, head):
        """
        :type head: ListNode
        :rtype: ListNode
        """
        tmp=head
        while tmp:
            while tmp.next and tmp.next.val==tmp.val:
                tmp.next=tmp.next.next
            tmp=tmp.next
        return head
        

  

posted @ 2017-12-30 20:29  PirateLHX  阅读(104)  评论(0编辑  收藏  举报