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.
This is great! I coded the solution to this problem in accordance with your comment!
prevVal=-1resultVal=1defcheck_binary_search_tree_(root):inOrder(root)ifresultVal==1:returnTrueelifresultVal==0:returnFalse# perform an in order traversal definOrder(root):ifrootisNone:returnelse:inOrder(root.left)globalprevValifprevVal<root.data:prevVal=root.dataelse:globalresultValresultVal=0returninOrder(root.right)
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Is This a Binary Search Tree?
You are viewing a single comment's thread. Return to all comments →
This is great! I coded the solution to this problem in accordance with your comment!