Domanda di colloquio di Tata Consultancy Services

Coding question was quite confusing