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