Synopsys Interview Question

Solve a problem related to tree traversal.