https://shuati.gitbook.io/crack-lintcode/~/edit/drafts/-LML4yotQUd1ltlwtPxk/binary-tree/find-leaves-of-binary-tree-07-25arrow-up-right
time o(n),space o(n)
mimic the leave level as index,
when we recursively call dfs to the leave, we get the return is 0, if now res.size() <= index, which means we neet to create a new list, otherwise , the corresponding index list is already in the res
return index+1 to the upper level
Last updated 7 years ago