AT&T interview question

Producer/consumer type problem.