标签:return structure 技术 alt substr elf and 面试 not
题目描述:
方法一:O(MN) O(M)
class Solution: def isSubStructure(self, A: TreeNode, B: TreeNode) -> bool: def equal(A,B): if not B:return True if not A or A.val != B.val:return False return equal(A.left,B.left) and equal(A.right,B.right) return bool(A and B) and (equal(A,B) or self.isSubStructure(A.left,B) or self.isSubStructure(A.right,B))
标签:return structure 技术 alt substr elf and 面试 not
原文地址:https://www.cnblogs.com/oldby/p/12720137.html