# 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 = right
class Solution:
def pruneTree(self, root: TreeNode) -> TreeNode:
if root == None: return None
if root.left:
root.left = self.pruneTree(root.left)
if root.right:
root.right = self.pruneTree(root.right)
if root.left is None and root.right is None and root.val == 0:
return None
return root