• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests
May 07, 2024 |230 Views
SDE Sheet - Check for BST
Description
Discussion

This video is part of the BST section under GFG SDE Sheet.

In this problem, we are given the root of a binary tree. Check whether it is a BST or not.
Note: We are considering that BSTs can not contain duplicate Nodes. A BST is defined as follows:

The left subtree of a node contains only nodes with keys less than the node's key.
The right subtree of a node contains only nodes with keys greater than the node's key.

Try it out before watching the implementation of the problem in the video. We recommend watching the video, even if you can solve the problem. You may discover something new. All the best!!!

Do check out:-
Article: https://www.geeksforgeeks.org/a-program-to-check-if-a-binary-tree-is-bst-or-not/
Problem: https://www.geeksforgeeks.org/problems/check-for-bst/1
SDE Sheet Link: https://www.geeksforgeeks.org/sde-sheet-a-complete-guide-for-sde-preparation/