# Binary Tree Right Side View (Leetcode 199)

Problem Link: <https://leetcode.com/problems/binary-tree-right-side-view/>

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