Apple Interview Question

How would you tackle this problem?