Pregunta de entrevista de Meta

One string manipulation and one tree question