Capgemini interview question

Write code for some particular problems