Concept Flow - Right Side View of Binary Tree
Start at root node
Initialize queue with root
While queue not empty
Get number of nodes at current level
For each node at this level
Dequeue node
If last node at level, record value
Enqueue left child if exists
Enqueue right child if exists
Repeat for next level
Return collected right side view values
We use a queue to do level order traversal. At each level, we record the last node's value to get the right side view.