Recent Articles:
- What are sales pipeline stages
- Salesforce CRM Training tutorial for beginners
- Daily standup meeting template
--
Day 7: Question 1
Write a method to check that a binary tree is a valid binary search tree.
A binary search tree is a binary tree in which, for each node, the node's value is greater than all values in the left subtree, and the node's value is less than all values in the right subtree.
-
If you want to follow along, feel free to post your answers in the comment.
My answers are in the comments.
This problem is from InterviewCake.
Top comments (1)
Input: binary tree
Output - Boolean - check if it is a binary search tree ..
Logic:
This is in O[n] time.