@@ -0,0 +1,1428 @@
+%22%22%22%0AQuestion:%0A    Remove Duplicates from Sorted List%0A%0A    Given a sorted linked list, delete all duplicates such that each element appear only once.%0A%0A    For example,%0A    Given 1-%3E1-%3E2, return 1-%3E2.%0A    Given 1-%3E1-%3E2-%3E3-%3E3, return 1-%3E2-%3E3.%0A%0A%0APerformance:%0A    1. Total Accepted: 79069 Total Submissions: 227384 Difficulty: Easy%0A    2. Your runtime beats 58.09%25 of python submissions.%0A%22%22%22%0A%0A%0A# Definition for singly-linked list.%0Aclass ListNode(object):%0A    def __init__(self, x):%0A        self.val = x%0A        self.next = None%0A%0Aclass Solution(object):%0A    def deleteDuplicates(self, head):%0A        %22%22%22%0A        :type head: ListNode%0A        :rtype: ListNode%0A        %22%22%22%0A        if head is None or head.next is None:%0A            return head%0A%0A        curr_node = head%0A%0A        while curr_node.next:%0A            if curr_node.val == curr_node.next.val:%0A                curr_node.next = curr_node.next.next%0A            else:%0A                curr_node = curr_node.next%0A%0A        return head%0A%0A%0Al1 = ListNode(1)%0Al2 = ListNode(1)%0Al3 = ListNode(2)%0Al1.next = l2%0Al2.next = l3%0A%0ASolution().deleteDuplicates(l1)%0Aassert l1.next is l3%0A%0A%0Am1 = ListNode(1)%0Am2 = ListNode(1)%0Am3 = ListNode(2)%0Am4 = ListNode(3)%0Am5 = ListNode(3)%0Am1.next = m2%0Am2.next = m3%0Am3.next = m4%0Am4.next = m5%0A%0ASolution().deleteDuplicates(m1)%0Aassert m1.next is m3%0Aassert m3.next is m4%0A%0An1 = ListNode(1)%0An2 = ListNode(1)%0An1.next = n2%0ASolution().deleteDuplicates(n1)%0Aassert n1.next is None%0A

Add 83-remove-duplicates-from-sorted-list.py