Capgemini interview question

In technical round, I was asked to write a codes.