Merge Two Binary Trees

Merge Two Binary Trees

Given two binary trees, root1 and root2, merge them into a new binary tree and return its root.

Merge rules:

  • If both trees have a node at the same position, the new ...

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: