Netflix interview question

Tree traversal