Pregunta de entrevista de OkCupid

It's a popular optimization problem.