Shopee Interview Question

How do you solve this particular problem?