Pregunta de entrevista de Amazon

tree and graph problem and a system design question