Python iterative using parent pointer
\nclass Solution:\n    def delNodes(self, root: TreeNode, to_delete: List[int]) -> List[TreeNode]:\n        # DFS, iterative using parent node\n        \n      
```\nclass Solution:\n    def delNodes(self, root: TreeNode, to_delete: List[int]) -> List[TreeNode]:\n        # DFS, iterative using parent node\n        \n        if not root:\n            return []\n        \n        if not to_delete:\n            return [root]\n        \n        toDel = set(to_delete)\n        \n        stk = [(None, root)]\n        res = []\n        \n        while stk:\n            parent, node = stk.pop()\n            \n            if node.val in toDel:\n                if node.left:\n                    stk.append((None, node.left))\n                if node.right:\n                    stk.append((None, node.right))\n                    \n            else:\n                if node.left:\n                    stk.append((node, node.left))\n                    if node.left.val in toDel:\n                        node.left = None\n                if node.right:\n                    stk.append((node, node.right))\n                    if node.right.val in toDel:\n                        node.right = None\n                if not parent or parent.val in toDel:\n                    res.append(node)\n        \n        return res\n```
['Depth-First Search', 'Iterator', 'Python3']