Skip to content

Commit 68b59fa

Browse files
committed
feat(data structures, binary trees): min camera cover
1 parent edb21ca commit 68b59fa

File tree

7 files changed

+981
-856
lines changed

7 files changed

+981
-856
lines changed

datastructures/trees/binary/tree/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,3 +374,20 @@ Visible nodes are 5, 6 & 8
374374
> For example: Node 4 is not visible since 5>4, similarly Node 3 is not visible since both 5>3 and 4>3. Node 8 is
375375
> visible since all 5<=8, 4<=8, and 8<=8.
376376
377+
---
378+
379+
## Minimum Camera Cover
380+
381+
You are given the root of a binary tree. Cameras can be installed on any node, and each camera can monitor itself, its
382+
parent, and its immediate children.
383+
384+
Your task is to determine the minimum number of cameras required to monitor every node in the tree.
385+
386+
Constraints:
387+
388+
- The number of nodes in the tree is in the range [1, 1000].
389+
- Node.data == 0
390+
391+
![Example 1](./images/examples/minimum_camera_cover_binary_tree_example_1.png)
392+
![Example 2](./images/examples/minimum_camera_cover_binary_tree_example_2.png)
393+
![Example 3](./images/examples/minimum_camera_cover_binary_tree_example_3.png)

0 commit comments

Comments
 (0)