class Solution: def isSameTree(self, p, q) -> bool: if not p and not q: return True elif p is not None and q is not None: if p.val==q.val: return self.isSameTree(p.left,q.left) and self.isSameTree(p.right,q.right) else: return False else: return False
执行用时 :40 ms, 在所有 Python3 提交中击败了95.91%的用户 内存消耗 :13.8 MB, 在所有 Python3 提交中击败了5.10%的用户 难过,我还是不知道它怎么输入的。。。。。 我现在好瞌睡。。。。 ——2019.9.24
查看更多关于leetcode——100.相同的树的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://www.haodehen.cn/did171396