Binary Tree Cameras | Live Coding with Explanation | Leetcode - 968

preview_player
Показать описание
Detailed explanation for Binary Tree Cameras Leetcode 968

To support us you can donate

Check out our other popular playlists:
Questions you might like:

If you find any difficulty or have any query then do COMMENT below. PLEASE help our channel by SUBSCRIBING and LIKE our video if you found it helpful.

#coding #leetcode #programminglife #programmingisfun #programmer #tech #software #codinglife #leetcode
Рекомендации по теме
Комментарии
Автор

We hope you all are enjoying our videos!!! Don't forget to leave a comment!!! Please like the video to support us!!!

Questions you might like:

Struggling in a question??

Leave in a comment and we will make a video!!!🙂🙂🙂

AlgorithmsMadeEasy
Автор

parent == null should only be true for one time (root node case) then answer is always one, i don't understand

NiteshKumar-doen
Автор

1st approach that came in mind is to do level order traversal and save that in Array List then add the odd list count i.e 1st, 3rd list to get the minimum camera.
2nd approach is optimization of 1st approach where we don't need to calculate the level order traversal and you have explained that in the an amazing way with dfs.
3rd approach is just fire :)
Thanks khushbu for the solution.

sharma.ajay
Автор

Everyday it gets a little easier. Thank you both of you.

heyrmi
Автор

Awesome explanation, and i am lucky to find this channel.

saitama_capedbaldy
Автор

In approach 1, how/why do you assume that root will be covered to start the solution?
In approach 2, when you start from leaf level, why do you assume that leaves will be covered?
Most important part is, explaining how do you reach some assumption with certain examples.

arghyapal
Автор

Can I ask why left and right can equal to 0 in a DFS fucntion where the base case is set to " if node == null, return 1?"

sakanademon
Автор

I feel like this there’s counter case for the algorithm

Take the same tree as in video. Remove right child of the root
On new tree algorithm would still give 3, while correct answer is 2

TheEdwinpako
Автор

I get a similar solution from a blog, but it didn't explain so much. This video is helpful, thank you!

nate-nfsv
Автор

Thanks for providing multiple solutions and the explanation was clear.

schan
Автор

Top class explanation and solution....Keep it up✌✌

lohitpoojary
Автор

greate video, appreciate your efforts. Thanks

abhijitbiradar
Автор

Hey, Thanks a lot for these videos. Nice explanation. The graphical explanation you put here is very helpful.

vivekhattarge
Автор

Let the leaf nodes be at level 1, their parents are at level 2, and so on. Then you should only need cameras at levels n%3 + 2. ie. every 3rd level. All of the examples are at every other level. However, this results in the odd levels (other then the leaf nodes) being covered by two cameras, which is not neccessary.

dcauz
Автор

I was thinking the same but i was unable to figure out how i could find covered node in short i was unable to think set data structure !

asmitamhetre
Автор

This was awesome. Now second solution is entrenched in my mind !

ragingpahadi
Автор

Can you please tell how did u get the intution ?

soumyadiptabanerjee
Автор

in the set solution wht time complexity is not O(nlogn) wea re searchimg each element in the set also right

rajsharma
Автор

Hey, been following your channel for a while...Really nice and usefull....please upload the solutions of leetcode contests as :)

akashhiremath
Автор

Hi khusboo,
Can we have a level order traversal and get the count for alternate levels which is minimum ?

udaykumar
welcome to shbcf.ru