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

浙公网安备 33010602011771号