Palo Alto Networks Interview Question

Solve array problem including string