Capgemini Interview Question

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