Dollar Tree Interview Question

How do I problem solve