Amazon interview question

Trees, graphs, and nested lists