JAVA Recursive 100% Faster Solution
\n\nimport java.util.*;\n\nclass Solution {\n    public List<TreeNode> delNodes(TreeNode root, int[] to_delete) {\n        List<TreeNode> list = new ArrayList<>
```\n\nimport java.util.*;\n\nclass Solution {\n    public List<TreeNode> delNodes(TreeNode root, int[] to_delete) {\n        List<TreeNode> list = new ArrayList<>();\n        if (root == null) return list;\n        \n        HashSet<Integer> to_delete_set = new HashSet<>();\n        for (int i : to_delete) to_delete_set.add(i);\n        \n        root = inorder(root, to_delete_set, list);\n        if (root != null) list.add(root);\n        \n        return list;\n    }\n\n    private TreeNode inorder(TreeNode root, HashSet<Integer> to_delete_set, List<TreeNode> list) {\n        \n        if (root != null) {\n            \n            root.left = inorder(root.left, to_delete_set, list);\n            root.right = inorder(root.right, to_delete_set, list);\n            \n            if (to_delete_set.contains(root.val)) {\n                if (root.left != null) list.add(root.left);\n                if (root.right != null) list.add(root.right);\n                return null;\n            }\n            \n            return root;\n        } \n        return null;\n\n    }\n}\n```
['Recursion', 'Java']