OpenAI interview question

implementation heavy leetcode style question involving array manipulation