# Reverse Level Order Traversal of a Binary Tree (Leetcode 107)

Problem Link: <https://leetcode.com/problems/binary-tree-level-order-traversal-ii/>

```python
class Solution:
    def levelOrderBottom(self, root: Optional[TreeNode]) -> List[List[int]]:
        
        if(root is None):
            return []
        
        ans=[]
        q=[root]
        
        while(len(q)>0):
            temp=[]
            
            for i in range(len(q)):
                currnode=q.pop()
                if(currnode.right):
                    q.insert(0,currnode.right)
                if(currnode.left):
                    q.insert(0,currnode.left)
                temp.append(currnode.val)
                
            ans.append(temp[::-1])
            
        return ans[::-1]
```
