Skip to content

Latest commit

 

History

History
 
 

146

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

This question was asked by BufferBox.

Given a binary tree where all nodes are either 0 or 1, prune the tree so that subtrees containing all 0s are removed.

For example, given the following tree:

   0
  / \
 1   0
    / \
   1   0
  / \
 0   0

should be pruned to:

   0
  / \
 1   0
    /
   1