Apple interview question

data structure problem and system design