Quick Overview

Merge two rooted n-ary trees in which every node has an integer key, combining nodes only when their keys match under matching parents. Tests recursive tree traversal, matching children by key, handling roots with different keys, and producing a canonical preorder encoding of the merged tree.

Merge Two N-ary Trees by Matching Node Keys

Company: LinkedIn

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: easy

Interview Round: Technical Screen

Overview: Merge two rooted n-ary trees in which every node has an integer key, combining nodes only when their keys match under matching parents. Tests recursive tree traversal, matching children by key, handling roots with different keys, and producing a canonical preorder encoding of the merged tree.

Read the full LinkedIn Software Engineer interview experience this question came from

Loading…