Morgan Stanley interview question

DSA question on arrays