Capgemini Interview Question

Explain the algorithm of code you used in coding round