Domanda di colloquio di OpenAI

Multi-step coding question. Didn't finish the second part. Got rejected.