Pergunta de entrevista da empresa Bloomberg

Two coding questions similar to the Leetcode question