Tata Technologies interview question

Challenging