直接硬干下去
好爽喔==
对不起
一二三四五
def flipEquiv(self, root1: Optional[TreeNode], root2: Optional[TreeNode]) ->
bool:
def dfs(r1, r2):
if r1 is None and r2 is None:
return True
elif (r1 is None and r2 is not None) or (r1 is not None and r2 is
None) or r1.val!=r2.val:
return False
else:
return (dfs(r1.left,r2.left) and dfs(r1.right, r2.right)) or
(dfs(r1.left, r2.right) and dfs(r1.right, r2.left))
return dfs(root1, root2)