Pregunta de entrevista de Epic

Some algorithm questions, really hard