# Introduction

Given a binary tree, determine if it is a valid binary search tree (BST). Let's discuss more about some of the inputs.

# Approach

We consider the approach to keep track of minimum and maximum values allowed for any node.
The program performs the in-order traversal and in each recursive call, minimum and maximum range is passed. The range checks whether the current node’s value is within the given range. Example Use case [4, 2, 7, 1, 5, 0, 9] Main Code that calls the Util method with Min and Max initialised to null THe main logic that verifies that the value is in a valid range The stack diagram of how the flow would be, red circles denotes the failure cases
{"ft_lang_label":"__label__en","ft_lang_prob":0.8850028,"math_prob":0.94242,"size":678,"snap":"2021-43-2021-49","text_gpt3_token_len":138,"char_repetition_ratio":0.089020774,"word_repetition_ratio":0.0,"special_character_ratio":0.19764012,"punctuation_ratio":0.12307692,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9713759,"pos_list":[0,1,2,3,4,5,6,7,8],"im_url_duplicate_count":[null,4,null,4,null,4,null,4,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-10-20T11:04:45Z\",\"WARC-Record-ID\":\"<urn:uuid:bafaa55a-f04f-4ed7-9187-7fb45d03f8ae>\",\"Content-Length\":\"35366\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:cc975a02-994f-4b7b-8b9b-24daa12aac1a>\",\"WARC-Concurrent-To\":\"<urn:uuid:c7f8711a-70fe-4ed9-bed6-f08599ee3a86>\",\"WARC-IP-Address\":\"151.101.251.7\",\"WARC-Target-URI\":\"https://blog.vcillusion.co.in/validate-bst/\",\"WARC-Payload-Digest\":\"sha1:M52WV2SE4RR5HNEJG5PJCXWAAB5KFELF\",\"WARC-Block-Digest\":\"sha1:L6KNWFABO6JSVHHEF72SASZBZXLGAMMF\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-43/CC-MAIN-2021-43_segments_1634323585305.53_warc_CC-MAIN-20211020090145-20211020120145-00135.warc.gz\"}"}