leetcode83Remove Duplicates from Sorted List

xiaoxiao2021-02-28  98

# Definition for singly-linked list. # class ListNode(object): #     def __init__(self, x): #         self.val = x #         self.next = None class Solution(object):     def deleteDuplicates(self, head):         """         :type head: ListNode         :rtype: ListNode         """         dummy=head         while head and head.next:             if head.val==head.next.val:                 head.next=head.next.next             else:                 head=head.next

        return dummy

https://leetcode.com/problemset/algorithms/

转载请注明原文地址: https://www.6miu.com/read-39771.html

最新回复(0)