Palo Alto Networks interview question

Solve array problem including string