Check for BST

PHOTO EMBED

Fri Dec 01 2023 11:55:43 GMT+0000 (Coordinated Universal Time)

Saved by @nistha_jnn #c++

 bool solve(Node* root,int mini,int maxi)
    {
        if(!root)
        return true;
        if(root->data>mini and root->data<maxi)
        {
            bool lefti=solve(root->left,mini,root->data);
            bool righti=solve(root->right,root->data,maxi);
             if(lefti and righti)
        return true;
        }
       return false;
    }
    bool isBST(Node* root) 
    {
        return solve(root,INT_MIN,INT_MAX);
    }
content_copyCOPY

https://www.geeksforgeeks.org/problems/check-for-bst/1?page=3&company=Samsung&difficulty=School,Basic,Easy&sortBy=latest