Pregunta de entrevista de Revolut

Example of a difficult problem solved at University