Tesco Interview Question

Difficulty task how would you solve it