Lowest Common Ancestor of a Binary Search Tree - Leetcode 235 - Python

preview_player
Показать описание


0:00 - Read the problem
1:02 - Drawing Explanation
5:12 - Coding Explanation

leetcode 235

#binary #tree #python
Disclosure: Some of the links above may be affiliate links, from which I may earn a small commission.
Рекомендации по теме
Комментарии
Автор

IDK WHY YOU STARTED THIS CHANNEL BUT THIS IS A BLESSING FOR people like me. THANK YOU SO MUCH !

siddharthkapoor
Автор

You are one really rare talented teacher!

vladimirstrigunov
Автор

This code simplicity is God-level !!
Dude, I went like, this is it??
Then, I realized that this was actually it.

prafulparashar
Автор

You have a talent for making me feel like I overcomplicate things. Thank you for this solution and all the videos you make, your talent at problem-solving and teaching is godly.

jaminchung
Автор

This is one of the questions that I stared for a long time but understood it immediately after half of the video. Thanks for the great explanation as always.

wtcxdm
Автор

I have become substantial better in coding and solving difficult problems thanks to your channel. Keep it up!

romilrathi
Автор

It's amazing how simple and straightforward your solution is!

asmahamdym
Автор

This question made my brain hurt a bit, so glad you were here to explain this for all of us! Just wanted to express my gratitude love the way you kind of do an overall explanation before you code.

ms
Автор

After seeing your solution, it didn't took me a minute to solve this problem in c++, Really very nice, keep going.

FANSasFRIENDS
Автор

Thank you so much! Please keep updating leetcode solutions! Your videos really help me a lot!! Great appreciate!

julieh_my
Автор

Hello. Loving all these videos and the neetcode website (even though I am learning very slowly). Just an update, this problem on Leetcode is being listed as a Medium now and not Easy anymore.

Actually just saw the entire video and....what!? How did you....wow this one just blew my mind.

hayatof
Автор

For anyone like me confused by him comparing the values of the nodes, a bst is organized so that child nodes on the left are less than the parent node, and child nodes on the right are greater than the parent node. This applies recursively for any node with children.

michaelgranger
Автор

You are one of the best people who can explain programming problems.

marwaeltayeb
Автор

Time Complexity will be O(n) in the worst possible case of tree being left skewed or right skewed.
Anyway as always awesome explanation bro.

sandeepreddysomu
Автор

Amazing video, kindly remind this is for Leetcode 235 instead of 236. One is for binary tree (unsorted), the other is for binary search tree (sorted)

chengjacky
Автор

I came up with the "solution" where I was checking if the node's value was one of the 2 given nodes and if not, I would go either left or right until I would find the solution. Your explanation was so much better, and it makes total sense. I've been wanting to ask; how did you get good at this? Are there any books you would recommend?

noelcovarrubias
Автор

Reminds me of the lowest common multiple (LCM) from math. You stop when a number cannot divide all the remainders at the same time. Thank you bro!

solodolo
Автор

My mind was blown after seeing your solution. Thanks my man!

harry
Автор

Wow that was way easier than I was making it. I didn't think about A) doing it iteratively or B) simply returning root if you have to split directions like that. I guess I didn't fully understand the problem. Thank you!

ethangordon
Автор

Very neat solution and excellent explanation

deepaligarg