MCPcopy Create free account
hub / github.com/HuberTRoy/leetCode / deleteDuplicates

Method deleteDuplicates

Array/RemoveDuplicatesFromSortedList.py:34–50  ·  view source on GitHub ↗

:type head: ListNode :rtype: ListNode

(self, head)

Source from the content-addressed store, hash-verified

32
33class Solution(object):
34 def deleteDuplicates(self, head):
35 """
36 :type head: ListNode
37 :rtype: ListNode
38 """
39 if not head:
40 return head
41
42 x = head
43
44 while head.next:
45 if head.val == head.next.val:
46 head.next = head.next.next
47 else:
48 head = head.next
49
50 return x

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected