C++|Recursion|Simple Solution
```\n/\n * Definition for a binary tree node.\n * struct TreeNode {\n *     int val;\n *     TreeNode left;\n *     TreeNode right;\n *     TreeNode() : val(0),
```\n/**\n * Definition for a binary tree node.\n * struct TreeNode {\n *     int val;\n *     TreeNode *left;\n *     TreeNode *right;\n *     TreeNode() : val(0), left(nullptr), right(nullptr) {}\n *     TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}\n *     TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}\n * };\n */\nclass Solution {\npublic:\n    vector<TreeNode*>v;\n    TreeNode* solve(TreeNode* root,set<int>st){\n        if(root==NULL){\n            return NULL;\n        }\n        root->left=solve(root->left,st);\n        root->right=solve(root->right,st);\n        if(st.count(root->val)){\n            if(root->left!=NULL){\n                v.push_back(root->left);\n            }\n            if(root->right!=NULL){\n                v.push_back(root->right);\n            }\n            return NULL;\n        }\n        \n        return root;\n        \n    }\n    vector<TreeNode*> delNodes(TreeNode* root, vector<int>& to_delete) {\n        \n        set<int>st(to_delete.begin(),to_delete.end());\n        TreeNode* rem=solve(root,st);\n        if(rem){\n            v.push_back(rem);\n        }\n        return v;\n    }\n};
['Recursion', 'C']