Siemens Interview Question

tranverse a tree