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 also did the same but some test cases are not working .Here my code-
bool func(vector v)
{
int count=0;
for(int i=0;i v;
if(root==NULL)
return true;
if(root!=NULL)
{
checkBST(root->left);
v.push_back(root->data);
checkBST(root->right);
}
return func(v);
}
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 →
I also did the same but some test cases are not working .Here my code- bool func(vector v) { int count=0; for(int i=0;i v; if(root==NULL) return true; if(root!=NULL) { checkBST(root->left); v.push_back(root->data); checkBST(root->right); } return func(v);
}