Microsoft interview question

N-ary Tree Question