Google interview question

One tree-based algorithm question, one array-based question.