# Definition for a binary tree node.# class TreeNode:# def __init__(self, val=0, left=None, right=None):# self.val = val# self.left = left# self.right = rightclass Solution:def pruneTree(self, root: Optional[TreeNode]) -> Optional[TreeNode]:def dfs(node: TreeNode) -> int:if not node:return 0left = dfs(node.left)right = dfs(node.right)if left == 0:node.left = Noneif right == 0:node.right = Nonereturn left + right + node.valdummy = TreeNode(-1, root)dfs(dummy)return dummy.left