We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
I must agree. Not knowing how the tree was constructed based on the input - how it sets the root etc, made it difficult for me. Perhaps it was explained in a previous challenge somewhere but I did not find that.
Is This a Binary Search Tree?
You are viewing a single comment's thread. Return to all comments →
You should really explain how you generate the tree from input, so people can test their solutions locally as well.
I must agree. Not knowing how the tree was constructed based on the input - how it sets the root etc, made it difficult for me. Perhaps it was explained in a previous challenge somewhere but I did not find that.
Do you know how to do this?
Could anyone take some time and help me/others to understand the construction of the tree for the testcase.
2
1 2 4 3 5 6 7
Is the below correct? But the expected output is NO. So just like to check with you all.
Yes it is.
if tree like this:
-----------3
------2---------5
--1------4----6----7
no
first perform the required rotation buddy
They have built tree differently. Hence we have to use min max logic