Find Leaves of Binary Tree
Last updated
Last updated
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