Validate Binary Search Tree

--

Going forward in Data Science Interview preparation I am spending time to improve my skills by going over several programming challenges. I found this problem very popular and this was asked by companies like Facebook, Amazon and Google. Here is the problem:

There are many languages you can try but I will show solution using Python. First let us understand what is a tree and binary tree. That means it has 2 nodes: left and right and has a depth by going down.

Solution:

Having complexity of O(N) I find this solution to be right and I came across many times when they expect to use recursive method.

Hope this was helpful and please feel free to contact me @kristinelpetrosyan@gmail.com.

--

--