Create Binary Tree From Descriptions

Medium · Trees · about 20 minutes

Asked at Google, Amazon, Uber, LinkedIn, Bloomberg.

descriptions[i] = [parent, child, isLeft] says node parent has child as its left child if isLeft == 1, otherwise as its right child. Values are unique and the descriptions form a valid binary tree. Build it and return the root.

Related guides