Microsoft interview question

Traverse a weird tree