1325. Delete Leaves With a Given Value 還行 再找一題來寫好ㄌ def removeLeafNodes(self, root: Optional[TreeNode], target: int) -> Optional[TreeNode]: if root is None: return None root.left = self.removeLeafNodes(root.left, target) root.right = self.removeLeafNodes(root.right, target) if root.left is None and root.right is None and root.val==target: return None else: return root -- ※ 發信站: 批踢踢實業坊(ptt-website.tw), 來自: 125.228.146.144 (臺灣) ※ 文章網址: https://ptt-website.tw/Marginalman/M.1715955036.A.C8C
yam276: 別捲了 不然用Rust捲 05/17 22:10
OnishiSaori: 大師 05/17 22:11
JIWP: 你要用c寫 05/17 22:11
NTUtriangle: 大師 05/17 22:12
sustainer123: 大師 05/17 22:13
AKNY: 包養網尋找異性友伴。 05/17 22:13
argorok: 大師 05/17 22:14
DJYOSHITAKA: 肥肥我不會rust:( C是觸手在用的 05/17 22:17