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.
Connect with me on LinkedIn : / alisha-parveen-80579850
Check out our other playlists:
Dynamic Programming:
• Dynamic Programming
Trees:
• Trees
Heaps and Maps:
• Heaps and Maps
Arrays and Maths:
• Arrays and Maths
Bit Manipulation:
• Bit Manipulation
Greedy Algorithms:
• Greedy Algorithms
Sorting and Searching:
• Sorting and Searching
Strings:
• Strings
Linked Lists:
• Linked Lists
Stack and Queues:
• Stacks and Queues
Two Pointers:
• Two pointers
Graphs, BFS, DFS:
• Graphs, DFS, BFS
Backtracking:
• Backtracking
Non- DSA playlists:
Probability:
• Probability
SQL-Basic Join functions:
• SQL - Basic JOIN Funct...
SQL-Basic Aggregate functions:
• SQL-Basic Aggregate Fu...
Негізгі бет Corona Vaccine GeeksforGeeks Problem of the day | Binary Tree Cameras | Leetcode 968. | Binary Tree
Пікірлер: 50