Pregunta de entrevista de NVIDIA

Standard algorithmic question as on leetcode