Pregunta de entrevista de Encircle

boring and very long coding question.