Tesco Bengaluru interview question

Coding problem