Question:

https://practice.geeksforgeeks.org/problems/check-for-bst/1

**My approach:**

```
bool flag=true;
int check=INT_MIN;
void checker(Node *root)
{
if(root)
{
checker(root->left);
if(check>root->data)
{
flag=false;
return;
}
else
check=root->data;
checker(root->right);
}
}
bool isBST(Node* root)
{
flag=true;
checker(root);
return flag;
}
```

Solution is correct and **works** for below test case:

```
2
12 4
2 N 7 N 6 N 5 N 9 N 2 N 6
```

**But it does NOT works for (reversed order of above TC) :**

```
2
2 N 7 N 6 N 5 N 9 N 2 N 6
12 4
```

**Moreover it is working fine for single test cases.**

Any help will be appreciated!