Google interview question

1. Array Problem 2. Tree Problem