Question bank › Binary Search Tree
Dsa Binary Search Tree Warm-up

Validate BST Structure

Write a program to validate if the given integers form a valid binary search tree by checking the inorder traversal. You will be given space-separated integers as input. The output should be 'YES' if it forms a valid BST and 'NO' otherwise. Input format: - The first line contains space-separated integers representing the inorder traversal. Output format: - Print 'YES' or 'NO'. Example: Input: 1 2 3 4 5 Output: YES

Key concepts

binary_search_treevalidationinorder_traversal

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.