ICICI Bank Interview Question

Explain how do solved problem