Capgemini interview question

reasoning