Amazon interview question

Technical question - trees with use case