02. Inorder Traversal and BST
Last updated
Last updated
The problem can be found at the following link: Question Link
Since it is a BST, its inorder traversal should always be a sorted array, hence the code just checks if the array is sorted or not
Iterates through the array.
Checks if each element is less than its immediate successor.
Returns 1 if the entire array satisfies the condition, otherwise returns 0.
Time Complexity: O(N), where N is the number elements in the array
Auxiliary Space Complexity: O(1), as no extra space is used.
For discussions, questions, or doubts related to this solution, please visit our discussion section. We welcome your input and aim to foster a collaborative learning environment.
If you find this solution helpful, consider supporting us by giving a ⭐ star to the getlost01/gfg-potd repository.