Apple interview question

how to solve certain problems