Here is the interview question prompt, presented for reference.
Suppose we're given a binary tree, one with several leaves like such:
We're asked to get all the current leaf values, then delete the leaves. Then we repeat-- we again get the leaf values, and then delete-- proceeding until we're done with the root node.
How could we implement this in an efficient manner?
You can see the full challenge with visuals at this link.
Challenges • Asked over 2 years ago by Jake from AlgoDaily
This is the main discussion thread generated for Get Binary Tree Leaves (Main Thread).