diff options
Diffstat (limited to 'binary_tree_pruning.cpp')
-rw-r--r-- | binary_tree_pruning.cpp | 15 |
1 files changed, 0 insertions, 15 deletions
diff --git a/binary_tree_pruning.cpp b/binary_tree_pruning.cpp deleted file mode 100644 index 3bac07d..0000000 --- a/binary_tree_pruning.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include "leetcode.h" - -class Solution { -public: - TreeNode *pruneTree(TreeNode *root) { - if (root) { - root->left = pruneTree(root->left); - root->right = pruneTree(root->right); - if (root->left || root->right || root->val != 0) - return root; - } - delete root; - return nullptr; - } -}; |