• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests
December 03, 2023 |1.1K Views
PROBLEM OF THE DAY: 02/12/2023 | Inorder Traversal and BST
Description
Discussion

Welcome to the daily solving of our PROBLEM OF THE DAY with Siddharth Hazra. We will discuss the entire problem step-by-step and work towards developing an optimized solution. This will not only help you brush up on your concepts of Binary Search Trees but also build up problem-solving skills.

In this problem, we are given, an array arr of size N, to determine whether this array represents an inorder traversal of a BST.

Note: All keys in BST must be unique.

Example :

Input:
N = 3
arr = {2, 4, 5}
Output: 1
Explanation: 
The given array is in order traversal for the following tree:
   4
  / \
 2   5

Give the problem a try before going through the video. All the best!!!
Problem Link: https://practice.geeksforgeeks.org/problems/inorder-traversal-and-bst5855/1