Apple interview question

Basic implementation flow