← Questions

Merge two named trees

0
GoogleCodingLast asked May 2026

Each tree node is a dictionary with a name, an integer value and an ordered list of children. Given two such trees t1 and t2, build a new merged tree that follows t1's nodes and their order and takes each node's value from the matching node in t2 when there is one. Agree on how nodes are matched and what happens to nodes found only in t2.

Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding