Merge Two Ordered Trees with Duplicate Child Names

Given two trees t1 and t2, each node has:

  • name: a string
  • value: an integer
  • children: an ordered list of child nodes

Merge the two trees and return a new tree using the following rule...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: