Pergunta de entrevista da empresa Fast Enterprises

Easy–medium LeetCode style problem (optimized)