Pergunta de entrevista da empresa The Trade Desk

Common interview-style problem in JS