LinkedIn | Find Leaves of Binary Tree
16296

Given a imbalance binary tree, print the leaf nodes then remove those leaf node, print the new leaf nodes until only root node left.

For example:

          1
         / \
        2   3
       / \     
      4   5    

Print: [4 5 3], [2], [1]

https://leetcode.com/problems/find-leaves-of-binary-tree (premium)

Comments (19)