InterviewDB Question

Terminal Nodes: Count and Return All Leaf Nodes Satisfying a Value Condition

Question Details

Problem Given the root of a binary tree, return all terminal (leaf) nodes whose value satisfies a given predicate. Additionally, after collecting them, prune the tree so that no remaining leaf node fails the predicate — repeat pruning until stable. E…

Full Details

🔒

Unlock full leaked content

Full insider details, leaked discussions, and candidate experiences.

Get Premium →

Topics

Coding Onsite Phone