Morgan Stanley interview question

Array question