Question d’entretien chez Goldman Sachs

Write code to print top view of a binary tree.