@@ -0,0 +1,1543 @@
+%22%22%22%0AQuestion:%0A    Merge Two Sorted Lists%0A%0A    Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.%0A%0APerformance:%0A    1. Total Accepted: 82513 Total Submissions: 250918 Difficulty: Easy%0A    2. Your runtime beats 93.72%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 mergeTwoLists(self, l1, l2):%0A        %22%22%22%0A        :type l1: ListNode%0A        :type l2: ListNode%0A        :rtype: ListNode%0A        %22%22%22%0A        # Make everything easy, just take the next at the end.%0A        dummy_head = ListNode(0)%0A        curr_node = dummy_head%0A%0A        while l1 is not None and l2 is not None:%0A            if l1.val %3C l2.val:%0A                curr_node.next = l1%0A                l1 = l1.next%0A            else:%0A                curr_node.next = l2%0A                l2 = l2.next%0A            curr_node = curr_node.next%0A        curr_node.next = l1 or l2  # append the rest.%0A%0A        return dummy_head.next%0A%0A%0An1 = ListNode(1)%0An2 = ListNode(2)%0An3 = ListNode(3)%0An4 = ListNode(4)%0An5 = ListNode(5)%0An6 = ListNode(6)%0An7 = ListNode(7)%0An8 = ListNode(8)%0An1.next = n3%0An3.next = n5%0An5.next = n7%0An2.next = n4%0An4.next = n6%0An6.next = n8%0A%0Aresult = Solution().mergeTwoLists(n1, n2)%0Aassert result is n1%0Aassert n1.next is n2%0Aassert n2.next is n3%0Aassert n3.next is n4%0Aassert n4.next is n5%0Aassert n5.next is n6%0Aassert n6.next is n7%0Aassert n7.next is n8%0A

Add 21-merge-two-sorted-lists.py