Microsoft interview question

Write the code to spirally print a tree.