Bst check if tree is bst

can we do by doing inorder traversal and storing it in array and check if every element is greater than prv or not?

@guptashubham210a yes you can do it using inorder traversal but that would be a bit of Naive solution .
For optimising your solution you can think of using range values . Try doing it you will get the idea .

For your query , yes you can use a inorder traversal and if it comes out to be an sorted array then it is a BST. Hope it helps :slight_smile: if you have no further doubts please mark the query as resolved and rate me accordingly.