83. Remove Duplicates from Sorted List
题目:
https://leetcode.com/problems/remove-duplicates-from-sorted-list/
难度:
Easy
class Solution(object):
def deleteDuplicates(self, head):
"""
:type head: ListNode
:rtype: ListNode
"""
cur = head
while cur:
if cur.next:
if cur.val == cur.next.val:
cur.next = cur.next.next
else:
cur = cur.next
# cur.next None
else:
break
return head
网友评论