Search
⌘K
Get Premium
Leetcode 814. Binary Tree Pruning
Given a binary tree with node values 0 or 1, remove every subtree that does not contain a 1 and return the pruned tree. This requires a post-order traversal to determine for each node whether its left/right subtrees contain any 1s and should be kept.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.