Pergunta de entrevista da empresa Palantir Technologies

Difficult Algorithm question.