Tata Steel interview question

Technical Question