Salesforce interview question

Array problem