# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def deleteDuplicates(self, head: ListNode) -> ListNode:
if not head:
return None
re=head
while head.next:
if head.val==head.next.val:
head.next=head.next.next
else:
head=head.next
return re
删除排序链表重复元素
猜你喜欢
转载自blog.csdn.net/weixin_45569078/article/details/104687535
今日推荐
周排行