Re: [闲聊] 每日leetcode

楼主: DJYOMIYAHINA (通通打死)   2024-10-24 23:32:54
直接硬干下去
好爽喔==
对不起
一二三四五
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)
作者: sixB (6B)   2024-10-24 23:35:00
ans挂在上面哭
楼主: DJYOMIYAHINA (通通打死)   2024-10-24 23:35:00
我改了== 对不起
作者: sixB (6B)   2024-10-24 23:40:00
对不起 我开玩笑的
作者: oin1104 (是oin的说)   2024-10-24 23:47:00
我哭了 只剩我写几十行了

Links booklink

Contact Us: admin [ a t ] ucptt.com