Create Binary Tree From Descriptions
A medium-tier problem at 82% community acceptance, tagged with Array, Hash Table, Tree. Reported in interviews at Clari and 1 others.
You're given pairs of parent-child relationships and a direction (left or right), and you need to construct the actual binary tree from scratch. LinkedIn and Clari both ask this. The acceptance rate sits at 82%, which sounds forgiving until you realize the trick isn't about tree construction, it's about spotting the root node when you don't have it handed to you. Most candidates waste time on the tree building itself and miss the graph logic that identifies which node has no parent. If this problem hits your live assessment and the pattern doesn't click, StealthCoder solves it invisibly in seconds.
Companies that ask "Create Binary Tree From Descriptions"
Create Binary Tree From Descriptions is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Made by an Amazon engineer who watched the leaked-problem repo become an industry secret. He decided you should have it too.
Get StealthCoderThe core pattern is simple but easy to botch: build a hash table mapping each node to its parent, then iterate through all nodes and find the one that isn't anyone's child. That's your root. From there, use the descriptions to populate left and right pointers. The gotcha is that candidates often overthink the tree construction and underestimate the importance of tracking which nodes are children. Hash table lookups are O(1), so the whole solution is O(n). Array iteration to find the root is the real bottleneck, not the tree building. The tree, hash table, and array topics all converge here, you're not really doing complex tree logic, you're doing set operations on parent-child relationships. When you blank on that insight during the live OA, StealthCoder bypasses the mental block and delivers a working solution.
Pattern tags
You know the problem.
Make sure you actually pass it.
Create Binary Tree From Descriptions recycles across companies for a reason. It's medium-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Made by an Amazon engineer who watched the leaked-problem repo become an industry secret. He decided you should have it too. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Create Binary Tree From Descriptions interview FAQ
How hard is this really for a medium?+
It's one of the easier mediums. The tree construction itself is trivial. The real challenge is remembering that you need to identify the root by finding the node with no parent, which is a hash table lookup problem in disguise. Most of the 82% acceptance rate comes from candidates who solve it in under 10 minutes once they see the pattern.
Do LinkedIn and Clari really ask this, or is it old data?+
Both companies report asking it in recent cycles. LinkedIn especially uses it as a screening problem because it tests multiple data structures in one shot: arrays, hash tables, and tree construction. It's not a hardcore trick problem, so it stays popular for early-round filters.
What's the trick to not confusing parent and child?+
The descriptions give you 'parent is left/right child of' wording. Read it backward: if parent X is the left child of parent Y, then X is the LEFT CHILD, not Y. Build two hash tables, one for children, one for all nodes mentioned. The root is the node in 'all nodes' that never appears as a child.
Should I use a graph approach or just build the tree directly?+
Direct tree construction is faster and simpler here. You don't need a full graph. Just store parent pointers and left/right child references. A single pass through descriptions populates everything, then one pass to find the root, then you're done. Hash table and array are your only data structures.
How does this relate to the other tree topics on the list?+
It touches Array (iterating descriptions), Hash Table (parent tracking and root lookup), and Binary Tree (the output). It's designed to test whether you can synthesize multiple data structures, not whether you know tree algorithms. No recursion, no balancing, no traversal, just assembly and identification.
Want the actual problem statement? View "Create Binary Tree From Descriptions" on LeetCode →