Pergunta de entrevista da empresa Clear Street

Leetcode style problem, medium to hard difficulty