filmov
tv
Corona Vaccine GeeksforGeeks Problem of the day | Binary Tree Cameras | Leetcode 968. | Binary Tree

Показать описание
Geek has developed an effective vaccine for Corona virus and he wants each of the N houses in Geek Land to have access to it. Given a binary tree where each node represents a house in Geek Land, find the minimum number of houses that should be supplied with the vaccine kit if one vaccine kit is sufficient for that house, its parent house and it's immediate child nodes.
Example 1:
Input:
1
/ \
2 3
\
4
\
5
\
6
Output:
2
Explanation:
The vaccine kits should be
supplied to house numbers 1 and 5.
Example 2:
Input:
1
/ \
2 3
Output:
1
Explanation:
The vaccine kits should be
supplied to house number 1.
Check out our other playlists:
Dynamic Programming:
Trees:
Heaps and Maps:
Arrays and Maths:
Bit Manipulation:
Greedy Algorithms:
Sorting and Searching:
Strings:
Linked Lists:
Stack and Queues:
Two Pointers:
Graphs, BFS, DFS:
Backtracking:
Non- DSA playlists:
Probability:
SQL-Basic Join functions:
SQL-Basic Aggregate functions:
Example 1:
Input:
1
/ \
2 3
\
4
\
5
\
6
Output:
2
Explanation:
The vaccine kits should be
supplied to house numbers 1 and 5.
Example 2:
Input:
1
/ \
2 3
Output:
1
Explanation:
The vaccine kits should be
supplied to house number 1.
Check out our other playlists:
Dynamic Programming:
Trees:
Heaps and Maps:
Arrays and Maths:
Bit Manipulation:
Greedy Algorithms:
Sorting and Searching:
Strings:
Linked Lists:
Stack and Queues:
Two Pointers:
Graphs, BFS, DFS:
Backtracking:
Non- DSA playlists:
Probability:
SQL-Basic Join functions:
SQL-Basic Aggregate functions:
Комментарии