Given the root of a binary tree, return the bottom-up level order traversal of its nodes' values. (i.e., from left to right, level by level from leaf to root).

&nbsp;
Example 1:

Input: root = [3,9,20,null,null,15,7]
Output: [[15,7],[9,20],[3]]


Example 2:

Input: root = [1]
Output: [[1]]


Example 3:

Input: root = []
Output: []


&nbsp;
Constraints:


	The number of nodes in the tree is in the range [0, 2000].
	-1000 &lt;= Node.val &lt;= 1000


class Solution:
    def levelOrderBottom(self, root: Optional[TreeNode]) -> List[List[int]]:
        def dfs(node, level, result):
            if not node:
                return
            if level >= len(result):
                result.append([])
            result[level].append(node.val)
            dfs(node.left, level+1, result)
            dfs(node.right, level+1, result)
        result = []
        dfs(root, 0, result)
        return result[::-1]
/**
 * Definition for a binary tree node.
 * public class TreeNode {
 *     int val;
 *     TreeNode left;
 *     TreeNode right;
 *     TreeNode() {}
 *     TreeNode(int val) { this.val = val; }
 *     TreeNode(int val, TreeNode left, TreeNode right) {
 *         this.val = val;
 *         this.left = left;
 *         this.right = right;
 *     }
 * }
 */
class Solution {
    public List<List<Integer>> levelOrderBottom(TreeNode root) {
        Queue<TreeNode> al=new LinkedList<>();
        List<List<Integer>> fal=new LinkedList<>();
        if(root==null) return fal;
        al.offer(root);
        while(!al.isEmpty()){
            List<Integer> aal=new LinkedList<>();
            int num=al.size();
            for(int i=0;i<num;i++){
                if(al.peek().left != null){
                    al.offer(al.peek().left);
                }
                if( al.peek().right != null){
                    al.offer(al.peek().right);
                }
                aal.add(al.poll().val);
            }
            fal.add(0,aal);
        }
        return fal;
    }
}
class Solution {
    void dft(TreeNode* root, int level, map<int,vector<int>,std::greater<int>>& levelVals)
    {
        if (root == nullptr)
            return;
        
        if (levelVals.find(level) == levelVals.end())
            levelVals[level] = {root->val};
        else
            levelVals[level].push_back(root->val);
        
        dft(root->left,level+1,levelVals);
        dft(root->right,level+1,levelVals);
    }
public:
    vector<vector<int>> levelOrderBottom(TreeNode* root) {
        map<int,vector<int>,std::greater<int>> levelVals;
        dft(root,0,levelVals);
        
        vector<vector<int>> res;
        for (const auto& [level,vals] : levelVals)
            res.push_back(vals);
        
        return res;
    }
};
var levelOrderBottom = function(root) {
    let solution = []
    function dfs(node, level) {
        if(!node) return null

        if(!solution[level]) solution[level] = []
        solution[level].push(node.val)

        dfs(node.left, level + 1)
        dfs(node.right, level + 1)
    }
    dfs(root, 0)
    return solution.reverse()
};
Binary Tree Level Order Traversal II