Giving Tree of Errors: Validate Parent-Child Pairs and Output Lexicographically Smallest S-Expression

Asked at Optiver · Coding Questions · Difficulty: Medium · Last asked Jul 15, 2026

Validate an unordered list of parent-child edges as a binary tree, and either report the highest-priority error code or print the tree's lexicographically smallest S-Expression.

Loading the problem…