Problem
Given a binary tree, return the bottom-up level order traversal of its nodes’ values. (ie, from left to right, level by level from leaf to root).
For example:
Given binary tree [3,9,20,null,null,15,7]
,
1 |
|
return its bottom-up level order traversal as:
1 |
|
Explanation
- Similar to 102. Binary Tree Level Order Traversal. This time, instead of adding the sublist to the end of the result list, we should add the sublist at the beginning of the result list.
Solution
1 |
|