Question: BFS a binary tree but print the last row in reverse order. Here last row means highest level leaf nodes.

Solution: While traversing the tree,keep a variable,currLevel for level. When a leaf is encountered,push it inside the stack and store its level as rowLevel.
Next time when a leaf is encountered,three cases are possible.
1 currLevel 2 currLevel=rowLevel:In this case,push the node to stack.
3 currLevel>rowLevel:In this case,empty the stack and push the current leaf into stack and rowLevel=currLevel.