Delete Nodes and Return Forest

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

Looking to make a Q&A video soon! Follow me on Instagram and shoot me a DM with your question if you're interested in participating!!!

KevinNaughtonJr
Автор

Just wondering.. how many attempts or how much time did it take you to initially solve these problems? I am still getting up to speed myself for some interviews, and it takes me a long time to figure out some of these. Love the videos and explanations.

klsajdklajldkadad
Автор

good way to teach the concept of bottom up tree processing with recursive DFS. haven't come across many of these problems yet. thanks, Kevin

JM_utube
Автор

These videos are incredibly helpful, really appreciate the way you walk through the problem instead of just diving into the code.

sunnilabeouf
Автор

Hey Kevin, could you do questions on dynamic programming. Thank you.

candicerusser
Автор

Amazing! I forgot to like and comment, so i came back to do it... Your content is full of learning and each line you speak weighs..

ankitagarwal
Автор

Did not expect that drop at the beginning lmao

brianevans
Автор

Super helpful video, I attempted this problem before watching and kind of pidgeon holed myself by checking vals on the way down as opposed to bottom up. Any advice on how to have the intuition when something will be bottom up/top down with regards to tree recursion (or is it safe to assume we'll probably always want a bottom up approach?).

navster
Автор

The best explanation I could find on YouTube about this problem. Thank you!

SelftaughtSoftwareEngineer
Автор

Thank you Kevin. This is very neat! I was able to solve the question in Python after watching your explanation and demo. Thanks again!

safakhan
Автор

I like the simple explanation. Good job.

stanislavmozolevskiy
Автор

Nice Explanation! So I'm new to this, could you tell me if this bottom up-approach is what is known as back-tracking?

mikasaackerman
Автор

Hey Kevin, I was wondering how is it making List inside the ArrayList?

SR-wevl
Автор

Since we are adding only left or right node to the remaining array, how will the sub array be created it the final result should be an array of nodes or roots not an array of sub arrays. I would like to know how the sub arrays were
created

alirahal
Автор

You deserve to be rich with YouTube money, hopefully you'll find sponsors and a boom in channel viewers.
You are a better teacher than most of my teacher in college

gurdoman
Автор

For the top-bottom approach, can't you just "save what your left and right sub trees are before removing the root? This way, you won't lose the reference to them... could you explain why this doesn't work?

rosiebahrani
Автор

The return type for the removeNode(...) method should be TreeNode and not void. I am not sure how it compiled and executed successfully for you?? Or did I miss something?

backendengineering
Автор

Would it be more consistent in the main function instead of checking for if {...} - check the return value of removeNodes(), and if it's NULL - add the root? Of course that'll fail if we got root==null as an argument, so an additional check for that will be needed. But it'll be needed in the current implementation as well.

sergten
Автор

bottom-up approach hint really clicked. thanks kevin!

waterislife
Автор

Amazing explaination...your videos are really very helpful...

pramodsharma