Optimal Algorithmic Approach
BFS (last of each level) or right-first DFS.
Core Invariants & Edge Cases
- BFS: take the last element of each level
- DFS: pass depth, record node value if depth == result.size()
- Right-first DFS naturally visits the rightmost node first at each depth