[Complete walkthrough | Fully Commented | Every Single Details]
Must Read completely in-order to understand how/why\nDont\' have time to read at all, just follow the code you\'ll get it I\'m sure.\n\n\n/*\n    This question 
**Must Read completely in-order to understand how/why**\n**Dont\' have time to read at all, just follow the code you\'ll get it I\'m sure.**\n\n```\n/*\n    This question is similar to other deletion type problem(s) on a Binary Tree.\n        + The only difference is that after deleting the required node\n            in the BT, don\'t need to connect either left/right child\n            to its parent.\n            \n            If deleted node has any child(s) then the child\n            gets disconnected from the original BT and from a separate Tree.\n            \n            For new separated tree(considered as single forest) the child node\n            acts as a root node.\n        \n        + After deletion is made to any node, we\'ve to send information to its\n            parent that your child(s) gets deleted and now you don\'t have its \n            access at all.\n                    Q: What is that information that want to send?\n                    A: null\n        \n    ==========================================================================\n    \n    Q: What type of nodes can occur in \'to_delete\' array?\n    A: Majorily two types of nodes:\n        1.) Internal Node(Non-Leaf)\n                + The node which we want to delete is a non-leaf node.\n                    * having at least one child\n                    \n            NOTE: When we delete such type of node, we\'ve add its non-null child(s)\n                    into our answer.\n            \n        2.) A leaf node\n                + Having no child at all\n            \n            NOTE: After deleting a leaf node, we don\'t need to add any of its child(s)\n                    in our answer since it\'s a leaf node.\n    ---------------------------------------------------------------------------------------\n    \n    Q: Which tree traversal is most appropriate for this problem?\n    A: \n        Under DFS, post-order traversal is appropriate choice for this question (according to me).\n        \n        Deleting from bottom to top is good choice because if we don\'t do, we may end up in a\n        situation in which we\'ve deleted the parent and tree gets disconnected and still want\n        to delete some its children.\n                + But since our tree is already gets disconnected and we don\'t have access to \n                    its children then how we do it.\n                    \n                this is the problem. Post-order traversal avoids encountering such a situation.\n*/\n\nclass Solution {\n    public List<TreeNode> delNodes(TreeNode root, int[] to_delete) {\n        List<TreeNode> forests = new ArrayList<>();\n        Set<Integer> set = new HashSet<>();\n        \n        // Inserting \'to_delete\' array elements into a set. To make the search efficient.\n        IntStream.range(0, to_delete.length).forEach(idx -> set.add(to_delete[idx]));\n        \n        TreeNode r = addForestsAfterDeletion(root, set, forests);\n        if(r != null) forests.add(r);\n        \n        return forests;\n    }\n    \n    private TreeNode addForestsAfterDeletion(TreeNode root, Set<Integer> to_delete,\n                                            List<TreeNode> forests) {\n        if(root == null) return null;\n        \n        // retured child(s){information from left & right} must be connected its parent\n        // in-order to maintain the structure after deletion gets performed / no-deletion at all.\n        root.left = addForestsAfterDeletion(root.left, to_delete, forests);\n        root.right = addForestsAfterDeletion(root.right, to_delete, forests);\n        \n        // If current root is the node which we want to delete\n        if(to_delete.contains(root.val)) {\n            if(root.left != null) forests.add(root.left);\n            if(root.right != null) forests.add(root.right);\n            root = null; // delete root node\n        }\n        \n        return root; //pass appropriate information to the parent.\n    }\n}\n```\n\n```\nClean Code\n```\n\n```\nclass Solution {\n    public List<TreeNode> delNodes(TreeNode root, int[] to_delete) {\n        List<TreeNode> forests = new ArrayList<>();\n        Set<Integer> set = new HashSet<>();\n        \n        IntStream.range(0, to_delete.length).forEach(idx -> set.add(to_delete[idx]));\n        TreeNode r = addForestsAfterDeletion(root, set, forests);\n        if(r != null) forests.add(r);\n        \n        return forests;\n    }\n    \n    private TreeNode addForestsAfterDeletion(TreeNode root, Set<Integer> to_delete,\n                                            List<TreeNode> forests) {\n        if(root == null) return null;\n        \n        root.left = addForestsAfterDeletion(root.left, to_delete, forests);\n        root.right = addForestsAfterDeletion(root.right, to_delete, forests);\n        \n        if(to_delete.contains(root.val)) {\n            if(root.left != null) forests.add(root.left);\n            if(root.right != null) forests.add(root.right);\n            root = null;\n        }\n        return root;\n    }\n}\n```\n\n*If you found this post helpful then please do upvote my solution*
['Java']