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: ✅✅✅[ Tree Data Structure] : kzbin.info/aero/PLJtzaiEpVo2zx-rCqLMmcFEpZw1UpGWls ✅✅✅[ Graphs Data Structure] : kzbin.info/aero/PLJtzaiEpVo2xg89cZzZCHqX03a1Vb6w7C ✅✅✅[ January 2021 Leetcoding Challenge] : kzbin.info/aero/PLJtzaiEpVo2wCalBcRcNjXQ0C6ku3dRkn ✅✅✅[ February 2021 Leetcoding Challenge] : kzbin.info/aero/PLJtzaiEpVo2wrfvII0eZQsPm-MZCmHodm ✅✅✅[ March 2021 Leetcoding Challenge] : kzbin.info/aero/PLJtzaiEpVo2zH-YC5ZiptbAvw2QZkmyk9 ✅✅✅[ April 2021 Leetcoding Challenge] :kzbin.info/aero/PLJtzaiEpVo2z9PpcJcsl5j3RXutiTU-GB ✅✅✅[ December 2020 Leetcoding Challenge] : kzbin.info/aero/PLJtzaiEpVo2xo8OdPZxrpybGR8FmzZpCA ✅✅✅[ November 2020 Leetcoding Challenge] : kzbin.info/aero/PLJtzaiEpVo2yMYz5RPH6pfB0wNnwWsK7e ✅✅✅[ August 2020 Leetcoding Challenge] : kzbin.info/aero/PLJtzaiEpVo2xu4h0gYQzvOMboclK_pZMe ✅✅✅[ July 2020 Leetcoding challenges] : kzbin.info/aero/PLJtzaiEpVo2wrUwkvexbC-vbUqVIy7qC- ✅✅✅[ June 2020 Leetcoding challenges] : kzbin.info/aero/PLJtzaiEpVo2xIPptnCvUtKrUcod2zAKG ✅✅✅[ May 2020 Leetcoding challenges] : kzbin.info/aero/PLJtzaiEpVo2wRmUCq96zsUwOVD6p66K9e ✅✅✅ Cracking the Coding Interview - Unique String: kzbin.info/aero/PLJtzaiEpVo2xXf4LZb3y_BopOnLC1L4mE Struggling in a question?? Leave in a comment and we will make a video!!!🙂🙂🙂
@heyrmi3 жыл бұрын
Everyday it gets a little easier. Thank you both of you.
@AlgorithmsMadeEasy3 жыл бұрын
Our pleasure!
@johnademola5283 жыл бұрын
Just exactly. They make it easier for me everyday. Thanks guys
@sharma.ajay26123 жыл бұрын
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.
@AlgorithmsMadeEasy3 жыл бұрын
Thanks
@saitama_capedbaldy97583 жыл бұрын
Awesome explanation, and i am lucky to find this channel.
@schan2638 ай бұрын
Thanks for providing multiple solutions and the explanation was clear.
@AlgorithmsMadeEasy8 ай бұрын
Thank you!!! 😊
@NiteshKumar-do4en2 жыл бұрын
parent == null should only be true for one time (root node case) then answer is always one , i don't understand
@arghyapal84392 жыл бұрын
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.
@lohitpoojary5053 Жыл бұрын
Top class explanation and solution....Keep it up✌✌
@AlgorithmsMadeEasy Жыл бұрын
Thanks a lot 😊
@sakanademon7772 жыл бұрын
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?"
@nate-nf9sv3 жыл бұрын
I get a similar solution from a blog, but it didn't explain so much. This video is helpful, thank you!
@AlgorithmsMadeEasy3 жыл бұрын
Glad to hear that !!
@Jay-lj2bv2 жыл бұрын
Beautiful explanation thanks!
@TheEdwinpako3 ай бұрын
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
@vivekhattarge57953 жыл бұрын
Hey, Thanks a lot for these videos. Nice explanation. The graphical explanation you put here is very helpful.
@AlgorithmsMadeEasy3 жыл бұрын
Glad you like it !!!
@abhishekkrishna97573 жыл бұрын
Very well explained! Thanks Could you please make a video on min. taps required to whole garden.
@AlgorithmsMadeEasy3 жыл бұрын
Thanks
@asmitamhetreАй бұрын
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 !
@abhijitbiradar Жыл бұрын
greate video, appreciate your efforts. Thanks
@AlgorithmsMadeEasy Жыл бұрын
Thanks Abhijit for the appreciation.
@dcauz2 жыл бұрын
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.
@___vandanagupta___2 жыл бұрын
Amazing solution!!!!!!
@AlgorithmsMadeEasy2 жыл бұрын
Thank you so much!!
@knimr32 жыл бұрын
Thanks!
@AlgorithmsMadeEasy Жыл бұрын
👌👌
@udaykumar5553 жыл бұрын
Hi khusboo, Can we have a level order traversal and get the count for alternate levels which is minimum ?
@soumyadiptabanerjee82563 жыл бұрын
Can you please tell how did u get the intution ?
@rupakkorde3 жыл бұрын
I get the intuition by solving a lot of test cases on paper
@soumyadiptabanerjee82563 жыл бұрын
@@rupakkorde How did you understand that you should start from the bottom ?
@rupakkorde3 жыл бұрын
@@soumyadiptabanerjee8256 I started filling cameras from top and found that camera at leaf node is covering less nodes
@soumyadiptabanerjee82563 жыл бұрын
@@rupakkorde Thanks. And how did u decide that there will be three states ? What i was thinking whether to place or not place, so was getting 2 states.
@rajsharma65992 жыл бұрын
in the set solution wht time complexity is not O(nlogn) wea re searchimg each element in the set also right
@ragingpahadi3 жыл бұрын
This was awesome. Now second solution is entrenched in my mind !
@AlgorithmsMadeEasy3 жыл бұрын
Great to hear that !! Thanks
@pranovkumar77873 жыл бұрын
Hey i have one doubt. In the second approach , a leaf node will always return 0 , and hence the parent to leaf node will always attach a camera. Now that seems problematic , because it isnt really placing the camera at the right position , though it is able to calculate the min number of camera's. But it isnt actually placing the camera at the right place. Especially in the 2nd case of your example.
@AlgorithmsMadeEasy3 жыл бұрын
In the case of leaf nodes, its child(null node) will return 1. And as the child is returning 1, the leaf node will return 0 that is, no camera. Moving up, the level before the leaf will have the camera installed. Hope this helps !!
@pranovkumar77873 жыл бұрын
@@AlgorithmsMadeEasy Right , But in the 2nd example of Tree that you took(4:25). There we are supposed add a camera on the left most leafNode, But in the code we will never add a camera to the leaf node, isnt it contradicting ?
@harifrahman99253 жыл бұрын
Solution with great intuition
@AlgorithmsMadeEasy3 жыл бұрын
Thanks !!
@akashhiremath41313 жыл бұрын
Hey, been following your channel for a while...Really nice and usefull....please upload the solutions of leetcode contests as well...... :)
@AlgorithmsMadeEasy3 жыл бұрын
Thanks !! We will try to put solutions for it.
@rahulgheware5752 Жыл бұрын
How can be parent==null condition to add camera on node
@RupinderSingh-gs8hz3 жыл бұрын
That's why I like this channel
@AlgorithmsMadeEasy3 жыл бұрын
Thanks 😀
@AviatorBro3 жыл бұрын
once again thanks for such a beautiful explanation, I wish it was in Hinglish language, I would not have to slow down video speed at some places to understand it😅
@zaid.12713 жыл бұрын
im confused on why the parent has to be null?? if its null then how did u get to it? am I missing something?
@zaid.12713 жыл бұрын
ohhh the parent == null is for the root I think I understand now.
@AlgorithmsMadeEasy3 жыл бұрын
Yes 👍.
@rahulgheware5752 Жыл бұрын
But then the ans is always going to be one
@rahulgheware5752 Жыл бұрын
Because due to and operator the second conditions not executed
@anamariaaguilarcahuana94173 жыл бұрын
Nice explained, i've been watching some of your videos and always say time complexity, How do you calculate it? I am justo 17 years old
@AlgorithmsMadeEasy3 жыл бұрын
Thanks Ana, Just read about its basics and practice it on a few code snippets. You will be great after it !!
@lucasjackson76473 жыл бұрын
Lookup big 0 notation, gayle laakmann mcdowell explains it well