Algorithm · Amazon · Medium
You are given a list of node descriptions for a binary tree, where each description is a triple [parentVal, childVal, isLeft]. parentVal is the integer value of the parent node. childVal is the integer value of the child node. isLeft is 1 if the child is the left child of its parent, and 0 if it is the right child. Construct the binary tree from these descriptions and return the root node. The descriptions may arrive in any order, so you must be prepared to create nodes as…