Amazon Interview Question

Technical question - trees with use case