Pregunta de entrevista de Clear Street

Leetcode style problem, medium to hard difficulty