Pergunta de entrevista da empresa Neilsen Industries

Queue question in dsa leetcode medium