Pregunta de entrevista de OpenAI

implementation heavy leetcode style question involving array manipulation