Skip to content

Instantly share code, notes, and snippets.

@amraks
Created February 17, 2019 18:29
Show Gist options
  • Save amraks/2268e7d3341993bccfeade8e773a7588 to your computer and use it in GitHub Desktop.
Save amraks/2268e7d3341993bccfeade8e773a7588 to your computer and use it in GitHub Desktop.
# 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':
cur = head
while cur and cur.next:
if cur.val == cur.next.val:
cur.next = cur.next.next
else:
cur = cur.next
return head
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment