Python求两棵树是否相同

2020-04-10T01:24:52
def isSameTree(p, q):
    if p == None and q == None:
        return True
    elif p and q :
        return p.val == q.val and isSameTree(p.left,q.left) and isSameTree(p.right,q.right)
    else :
        return False
当前页面是本站的「Baidu MIP」版。发表评论请点击:完整版 »