Can anybody tell me where the problem is? Python solution


  • -1
    W

    class solution():
    def merge(self,n,m):
    if n.v<=m.v:
    new = n
    else:
    new = m
    while n or m:
    if n == None and m ==None:
    return new
    elif n == None and m != None:
    new.p = m
    m = m.p
    elif n != None and m == None:
    new.p= n
    n = n.p
    elif n!=None and m!=None:
    if n.v<=m.v:
    new.p = n
    n = n.p
    else:
    new.p = m
    m = m.p
    return new


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.