LC 98
Validate Binary Search Tree
Medium · LC 1–100
Candidate solution routes
Primary
FreeBST ordering / inorder traversal
Invariant: At node entry, (low,high) is the intersection of all ancestor constraints; a legal value lies inside it. In inorder form, every visited value is greater than the previous one.
candidate confidence: 0.733 · metadata_only
Alternate 1
FreeTree recursive aggregation
Invariant: dfs(u) returns a summary concerning only u's subtree and satisfying its parent contract; before return, every global candidate fully contained in that subtree has been considered.
candidate confidence: 0.603 · metadata_only
How to use this page
Read the statement and constraints first, then validate recognition signals, invariant, and complexity. Candidate score is not correctness evidence.