Simple Java DFS
\nclass Solution {\n    List<TreeNode> result = new ArrayList();\n    Set<Integer> set = new HashSet();\n    public List<TreeNode> delNodes(TreeNode root, int[]
```\nclass Solution {\n    List<TreeNode> result = new ArrayList();\n    Set<Integer> set = new HashSet();\n    public List<TreeNode> delNodes(TreeNode root, int[] to_delete) {\n        for(int i : to_delete) set.add(i);\n        root = dfs(root);\n        if(root != null) result.add(root);\n        return result;\n    }\n    \n    private TreeNode dfs(TreeNode node){\n        if(node == null) return null;\n        node.left = dfs(node.left);\n        node.right = dfs(node.right);\n        if(set.contains(node.val)){\n            if(node.left != null) result.add(node.left);\n            if (node.right != null) result.add(node.right);\n            node = null;\n        }\n        return node;\n    }\n}\n```
['Depth-First Search', 'Java']