Apple interview question

Data structure and problem solving