Pergunta de entrevista da empresa NVIDIA

Standard algorithmic question as on leetcode