Beispiel #1
0
                    current.next = l1
                    l1 = l1.next
                else:
                    current.next = l2
                    l2 = l2.next
                current = current.next
            current.next = l1 if l1 else l2
            return dummyHead.next
        return l1 or l2


if __name__ == '__main__':
    list_1 = ListNode.buildSortedList(2)
    list_2 = ListNode.buildSortedList(3)

    ListNode.show(list_1)
    ListNode.show(list_2)

    solution = Solution()
    merged = solution.mergeTwoLists(list_1, list_2)

    ListNode.show(merged)

    # list_1 = ListNode.buildEmptyList()
    # list_2 = ListNode.buildSortedList(1)

    # ListNode.show(list_1)
    # ListNode.show(list_2)

    # solution = Solution()
    # merged = solution.mergeTwoListsRefine(list_1, list_2)