Synopsys interview question

Trasverse a tree