Dsa
Binary Search Tree
Hard
Check Valid BST Structure
You are tasked to validate whether a list of integers can represent the in-order traversal of a binary search tree (BST). Given a single line of input containing space-separated integers, determine if they can be arranged into a valid BST in order. Print 'Valid' if the integers can represent a BST; otherwise, print 'Invalid'. Example input/output format is below.
Input:
9 3 15 20 7
Output:
Invalid
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