Leetcode 968(Hard) Binary Tree Cameras: Simple C++ Solution

preview_player
Показать описание
In this video, I provide a simple solution with an explanation to the Leetcode 968: Binary Tree Cameras in the hard category. The problem is a tricky tree traversal problem and is optimally solved by the combination of postorder DFS and Greedy allocation. Hence solving the problem in O(N) time.
Рекомендации по теме
Комментарии
Автор

One logical error i think, please review.in the second case,
You are saying
If both of the children has covered, you are incrementing camera, but you are using logical OR over there, but saying Logical AND, it should be, if any of the children not covered, then we don't have any option rather than placing the camera,

jeeveshkataria
Автор

I think this one is not DFS, but it is Post Order Tran. Anyway! he make me solve this problem thank.

chanokplaisub
Автор

hi thanks for the explanation. Its great. Can u please do a video on binary tree coloring game as well

arunagiriswarane
Автор

Thank you for putting so much of efforts, nice explaination. Just one suggestion, instead of you speaking if you can show some example and use some visualization for whatever you are speaking than it would make things more clearer. keep it up.

lapujain
welcome to shbcf.ru