Tesco Bengaluru Interview Question

Coding problem