← Questions

Delete leaves with a target value, repeatedly

0
GoogleCodingLast asked Sep 2026

A coding interview question asked in Google's first round (coding), last asked Sep 2026. It tests trees and recursion.

Given a binary tree and a target value, delete every leaf that holds the target. Deleting a leaf can turn its parent into a leaf; if that parent also holds the target, delete it too, and keep going until no leaf with the target value is…

Sign in to unlock this question

The full prompt, the worked answer and your own canvas or code with the AI tutor. New accounts get 5 credits: each one unlocks a question for good.

Where it's asked

  • Google · First round: coding · Last asked Sep 202645 min · Coding in a Google Doc, no syntax highlighting or autocomplete · No AI

What it tests

trees · recursion

Your code and the AI tutor open when you unlock this question.