Pergunta de entrevista da empresa Bloomberg

Leetcode style question. System design