PayPal Interview Question

some algorithm question regarding array