Python recursion
\ndef delNodes(self, root: TreeNode, to_delete: List[int]) -> List[TreeNode]:\n        def delete(node, parent, res):\n            if not node: return None\n   
```\ndef delNodes(self, root: TreeNode, to_delete: List[int]) -> List[TreeNode]:\n        def delete(node, parent, res):\n            if not node: return None\n            \n            if node.val in to_delete:\n                delete(node.left, None, res)\n                delete(node.right, None, res)\n                return None\n            else:\n                if not parent:\n                    res.append(node)\n                node.left = delete(node.left, node, res)\n                node.right = delete(node.right, node, res)\n                return node\n        to_delete = set(to_delete)\n        res = []\n        delete(root, None, res)\n        return res\n```
[]