Binary Tree Cameras | Leetcode | DP on Trees

preview_player
Показать описание
good coding problem and an even better solution is here ;)
Enjoy watching!

Super useful books for algo ds and programming fundamentals!

Рекомендации по теме
Комментарии
Автор

no one teaches better than you, very calm and simple way of teaching. also video time is short so it keeps hooked to the video.

darshanshah
Автор

Dude, the intro is sooo funny 😂😂😂😂 I had to like it

elijah
Автор

I would like to thank you so much for bringing up such nice intuitive approaches !!
You are a true gem!
I hope that I could press that like button multiple times !!

gShashank
Автор

Kaafi cool ban gye aap pehle ek min me😂

abhinaysingh
Автор

Thankyou so much bro, I have used up a whole day to understand this. I have watched this video around 8 times coz I can't able to implement it due to the edge cases w/o referring to your code. Your content is no doubt exceptional, Thanks for that.
if(root == null) {
if(willPlace) return 1001;
return 0;
}

hymnish_you
Автор

15:03, dp( u, 0, 0 ) than why need of Case 1 and Case2. ( we have to return inf ) As we can see if the current node and parent node have not camera then if we place the camera its child node then the child node can only monitor the current node, not the parent node( no one can monitor) .
Anyone can tell me please ?

codex-yl
Автор

"Who can explain it better than Kartik Arora?🤣🤣🤣🤣" . I have not watched the full video yet, but my answer will be : Kartik Arora himself . Btw great job !

sujoyseal
Автор

why are we considering a case where we allow the parent also and the grand parent of current node also to not have the camera ? we do this for both left and right child and suppose it gives min answer ..wont it be wrong?

divanshmahajan
Автор

Where were you all these time....spent so much time on this problem already

tejasnakhate
Автор

could you explain the last condition dp(u, 0, 0) for a general tree with more than 2 subtrees(the code)

evolve.everydayy
Автор

bhiya ji to maze maze me samjha dete hain aur itni aasani se samjh bhi aa jata hai.cha gye bhiya ji.
like and subscribe zaroor kro bhaiyon

shubheshtiwari
Автор

Thanks👍 one day every1 will came to know about the precious content of your channel ..

tathagatnegi
Автор

Time will be order of nlogn ig, only because of the cache ie dp array . We are using map here and not unordered map .
We can't use unordered map .
Also we can't take a 3d dp because the first parameter is a node and not an integer

ujjwalmittal
Автор

thank you sir, i struggled a lot while solving, you made it easier .

psurya
Автор

great explanation. i missed the case where parent can cover a child, , and so missed that state and couldn't figure out what was wrong..Also can you please explain the greedy solution and first explain why it works... That blew my mind

jllnnnl
Автор

Nice tutorial, Kartik. Just one suggestion. I think the leaf case is not required to be handled. The base case (root == NULL) and the recursion itself handle that scenario. Thanks

kunalpuri
Автор

Sweet and Simple Explaination really loved it

kSERITIKGupta
Автор

lol... in the starting of video, all of a sudden i lost my dizziness.

jaishriharivishnu
Автор

Can you explain your base case when root==NULL ?
Why cant we always return 0?

darpan
Автор

Unable to understand why is there a need of keeping the monitoring state?

sahilkalamkar
join shbcf.ru