Capgemini Interview Question

reasoning