Amazon Interview Question

Top view of Binary Tree