Pregunta de entrevista de Block

first round is all algorithm