Amazon Interview Question

nda, but generally tree/array problems