diff options
Diffstat (limited to 'binary_tree_cameras.cpp')
-rw-r--r-- | binary_tree_cameras.cpp | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/binary_tree_cameras.cpp b/binary_tree_cameras.cpp deleted file mode 100644 index c73650b..0000000 --- a/binary_tree_cameras.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include "leetcode.h" - -class Solution { -public: - int ans; - int minCameraCover(TreeNode *root) { - if (helper(root) == 0) - ans++; - return ans; - } - -private: - int helper(TreeNode *root) { - if (!root) - return 1; - int l = helper(root->left); - int r = helper(root->right); - if (l == 0 || r == 0) { - ans++; - return 2; - } else if (l == 2 || r == 2) - return 1; - else - return 0; - } -}; - -int main() {} |