Google Interview Question

trees and arrays questions, medium difficulty