Example #1
0
def swapPairs(head):
    return list_node_from_iter(reverse_by_n(list_node_to_iter(head), 2))
def reverseKGroup(head, k):
    return list_node_from_iter(reverse_by_n(list_node_to_iter(head), k))
def mergeTwoLists(l1,l2):
    return list_node_from_iter(merge(min, map(list_node_to_iter, [l1,l2])))
def mergeTwoLists(l1, l2):
    return list_node_from_iter(merge(min, map(list_node_to_iter, [l1, l2])))
Example #5
0
def addTwoNumbers(l1, l2):
    return list_node_from_iter(
        add_by_digit(izip_longest(*map(list_node_to_iter, [l1, l2]), fill=0)))
def mergeKLists(lists):
    return list_node_from_iter(merge(min, map(list_node_to_iter, lists)))
def mergeKLists(lists):
    return list_node_from_iter(merge(min, map(list_node_to_iter, lists)))
def reverseKGroup(head, k):
    return list_node_from_iter(reverse_by_n(list_node_to_iter(head), k))
def addTwoNumbers(l1, l2):
    return list_node_from_iter(add_by_digit(izip_longest(*map(list_node_to_iter, [l1, l2]), fill=0)))