Amazon Interview Question

basic of trees and stacks