Pregunta de entrevista de Motorola Mobility

They asked coding questions regarding trees and array, Medium difficulty