Pergunta de entrevista da empresa Rokt

Coding problem similar to easy leetcode question