Pergunta de entrevista da empresa Bloomberg

I got a leetcode easy/medium type problem-solving.