Search in a Binary Search Tree Leetcode 700 Python

preview_player
Показать описание
🔴 Question Link -

✅Connect with me

🔴 Question with Example

Given the root node of a binary search tree (BST) and a value. You need to find the node in the BST that the node's value equals the given value. Return the subtree rooted with that node. If such node doesn't exist, you should return NULL.

For example,

Given the tree:
4
/ \
2 7
/ \
1 3

And the value to search: 2
Комментарии
Автор

Nice approach, thanks a lot for sharing!

thermalmedia
Автор

You are really good with algorithms. I hope to be good at algorithms by learning and practicing. Keep the good work

oluwalekedavid
Автор

Great work, I like your approach to thinking about how to solve the problem before going immediately coding, this what I didn't do it and so for that, I waste a lot of time trying to solve it because I jumping directly to coding. It seems very easy when doing it with iteration like linked-list.

wahbibaklouti
Автор

Hi!
Can somebody please explain how did we assign a variable to a while loop? I mean, what are the conditions for the loop in this case.

accountforyoutube
visit shbcf.ru