Created
February 17, 2019 18:29
-
-
Save amraks/2268e7d3341993bccfeade8e773a7588 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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