Quick Overview

Remove every binary-tree leaf whose value equals a target, repeating as parents turn into matching leaves, and return the possibly empty result in level-order form. It tests reasoning about cascading deletions, correct handling of the root, and edge cases such as matching internal nodes that keep a child.

Repeatedly Delete Leaves Matching a Target Value From a Binary Tree

Company: Google

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: hard

Interview Round: Technical Screen

Overview: Remove every binary-tree leaf whose value equals a target, repeating as parents turn into matching leaves, and return the possibly empty result in level-order form. It tests reasoning about cascading deletions, correct handling of the root, and edge cases such as matching internal nodes that keep a child.

Loading…