Google interview question

trees and arrays questions, medium difficulty