Amazon Interview Question

One question from array and another from tree