Pregunta de entrevista de Argos

A difficult algorithm question