Created
September 19, 2019 16:40
-
-
Save konstunn/1d9dc080c073a50bca66ae0cbd58fd0c to your computer and use it in GitHub Desktop.
This file contains hidden or 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: | |
while cur.next and cur.val == cur.next.val: | |
next_ = cur.next | |
cur.next = cur.next.next | |
cur = cur.next | |
return head | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment