Pregunta de entrevista de Amazon

Q: Question based on generic trees