Pergunta de entrevista da empresa LiveRamp

Just simply analysis the algorithm, running time and optimization would be OK